Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 22s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 14s
Laravel Pint / pint (pull_request) Successful in 2m35s
Laravel Larastan / larastan (pull_request) Failing after 3m50s
126 lines
2.9 KiB
PHP
126 lines
2.9 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class Plant extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $fillable = [
|
|
'code',
|
|
'company_id',
|
|
'name',
|
|
'address',
|
|
];
|
|
|
|
public function company(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Company::class);
|
|
}
|
|
|
|
public function blocks(): HasMany
|
|
{
|
|
return $this->hasMany(Block::class, 'plant_id', 'id');
|
|
}
|
|
|
|
public function lines(): HasMany
|
|
{
|
|
return $this->hasMany(Line::class, 'plant_id', 'id');
|
|
}
|
|
|
|
public function getLineNames()
|
|
{
|
|
return $this->hasMany(Line::class, 'plant_id', 'id');
|
|
}
|
|
|
|
public function items(): HasMany
|
|
{
|
|
return $this->hasMany(Item::class, 'plant_id', 'id');
|
|
}
|
|
|
|
public function stickersMasters(): HasMany
|
|
{
|
|
return $this->hasMany(StickerMaster::class, 'plant_id', 'id');
|
|
}
|
|
|
|
public function invoiceValidations()
|
|
{
|
|
return $this->hasMany(InvoiceValidation::class, 'plant_id', 'id');
|
|
}
|
|
|
|
public function stockDataMasters()
|
|
{
|
|
return $this->hasMany(StockDataMaster::class, 'plant_id', 'id');
|
|
}
|
|
|
|
public function qualityValidations()
|
|
{
|
|
return $this->hasMany(QualityValidation::class, 'plant_id', 'id');
|
|
}
|
|
|
|
public function testingPanelReadings()
|
|
{
|
|
return $this->hasMany(TestingPanelReading::class, 'plant_id', 'id');
|
|
}
|
|
|
|
public function guardNames()
|
|
{
|
|
return $this->hasMany(GuardName::class, 'plant_id', 'id');
|
|
}
|
|
|
|
public function checkPointNames()
|
|
{
|
|
return $this->hasMany(CheckPointName::class, 'plant_id', 'id');
|
|
}
|
|
|
|
public function checkPointTimes()
|
|
{
|
|
return $this->hasMany(CheckPointTime::class, 'plant_id', 'id');
|
|
}
|
|
|
|
public function guardPatrolEntries()
|
|
{
|
|
return $this->hasMany(GuardPatrolEntry::class, 'plant_id', 'id');
|
|
}
|
|
|
|
public function workGroupMasters()
|
|
{
|
|
return $this->hasMany(WorkGroupMaster::class, 'plant_id', 'id');
|
|
}
|
|
|
|
public function processOrders()
|
|
{
|
|
return $this->hasMany(ProcessOrder::class, 'plant_id', 'id');
|
|
}
|
|
|
|
public function productCharacteristicsMasters()
|
|
{
|
|
return $this->hasMany(ProductCharacteristicsMaster::class, 'plant_id', 'id');
|
|
}
|
|
|
|
public function characteristicValues()
|
|
{
|
|
return $this->hasMany(CharacteristicValue::class, 'plant_id', 'id');
|
|
}
|
|
|
|
public function equipmentMasters()
|
|
{
|
|
return $this->hasMany(EquipmentMaster::class, 'plant_id', 'id');
|
|
}
|
|
|
|
// public function rejectReasons()
|
|
// {
|
|
// return $this->hasMany(RejectReason::class, 'plant_id', 'id');
|
|
// }
|
|
|
|
public function users()
|
|
{
|
|
return $this->hasMany(User::class, 'plant_id', 'id');
|
|
}
|
|
}
|