85 lines
2.0 KiB
PHP
85 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace Modules\IndustrialEngineering\Models;
|
|
|
|
use App\Contact;
|
|
use App\Transaction;
|
|
use App\TransactionSellLine;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Modules\Maintenance\Models\Equipment;
|
|
use Modules\Project\Entities\Project;
|
|
|
|
class CustomerInstalledAsset extends Model
|
|
{
|
|
use BelongsToBusiness;
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'ie_customer_installed_assets';
|
|
|
|
protected $guarded = ['id'];
|
|
|
|
protected $casts = [
|
|
'sold_at' => 'date',
|
|
'installed_at' => 'date',
|
|
'commissioned_at' => 'date',
|
|
'as_sold_snapshot' => 'array',
|
|
'as_installed_snapshot' => 'array',
|
|
];
|
|
|
|
public function serializedUnit()
|
|
{
|
|
return $this->belongsTo(SerializedUnit::class, 'serialized_unit_id');
|
|
}
|
|
|
|
public function lineRevision()
|
|
{
|
|
return $this->belongsTo(LineRevision::class, 'line_revision_id');
|
|
}
|
|
|
|
public function customer()
|
|
{
|
|
return $this->belongsTo(Contact::class, 'customer_id');
|
|
}
|
|
|
|
public function project()
|
|
{
|
|
return $this->belongsTo(Project::class, 'project_id');
|
|
}
|
|
|
|
public function maintenanceEquipment()
|
|
{
|
|
return $this->belongsTo(Equipment::class, 'maintenance_equipment_id');
|
|
}
|
|
|
|
public function sellTransaction()
|
|
{
|
|
return $this->belongsTo(Transaction::class, 'sell_transaction_id');
|
|
}
|
|
|
|
public function sellLine()
|
|
{
|
|
return $this->belongsTo(TransactionSellLine::class, 'sell_line_id');
|
|
}
|
|
|
|
public function warranties()
|
|
{
|
|
return $this->hasMany(CustomerAssetWarranty::class, 'installed_asset_id');
|
|
}
|
|
|
|
public function commissioningRecords()
|
|
{
|
|
return $this->hasMany(CommissioningRecord::class, 'installed_asset_id');
|
|
}
|
|
|
|
public function installationTasks()
|
|
{
|
|
return $this->hasMany(InstallationTask::class, 'installed_asset_id');
|
|
}
|
|
|
|
public function lessonsLearned()
|
|
{
|
|
return $this->hasMany(LessonsLearned::class, 'installed_asset_id');
|
|
}
|
|
}
|