75 lines
1.8 KiB
PHP
75 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace Modules\AssetExchange\Models;
|
|
|
|
use App\Business;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class AppraisalLine extends Model
|
|
{
|
|
protected $table = 'aex_appraisal_lines';
|
|
|
|
protected $fillable = [
|
|
'business_id',
|
|
'appraisal_id',
|
|
'parent_line_id',
|
|
'line_kind',
|
|
'name',
|
|
'manufacturer',
|
|
'model',
|
|
'serial_number',
|
|
'ie_item_master_id',
|
|
'ie_bom_line_id',
|
|
'maintenance_equipment_part_id',
|
|
'year_manufactured',
|
|
'age_years',
|
|
'working_hours',
|
|
'health_percentage',
|
|
'condition_notes',
|
|
'renovation_need',
|
|
'renovation_cost',
|
|
'replacement_cost',
|
|
'depreciation_rate',
|
|
'line_as_is_value',
|
|
'line_post_renovation_value',
|
|
'keep_in_line',
|
|
'photos',
|
|
'sort_order',
|
|
];
|
|
|
|
protected $casts = [
|
|
'year_manufactured' => 'integer',
|
|
'age_years' => 'decimal:2',
|
|
'working_hours' => 'decimal:2',
|
|
'health_percentage' => 'decimal:2',
|
|
'renovation_cost' => 'integer',
|
|
'replacement_cost' => 'integer',
|
|
'depreciation_rate' => 'decimal:4',
|
|
'line_as_is_value' => 'integer',
|
|
'line_post_renovation_value' => 'integer',
|
|
'keep_in_line' => 'boolean',
|
|
'photos' => 'array',
|
|
'sort_order' => 'integer',
|
|
];
|
|
|
|
public function business()
|
|
{
|
|
return $this->belongsTo(Business::class);
|
|
}
|
|
|
|
public function appraisal()
|
|
{
|
|
return $this->belongsTo(Appraisal::class, 'appraisal_id');
|
|
}
|
|
|
|
public function parentLine()
|
|
{
|
|
return $this->belongsTo(self::class, 'parent_line_id');
|
|
}
|
|
|
|
public function childLines()
|
|
{
|
|
return $this->hasMany(self::class, 'parent_line_id')->orderBy('sort_order');
|
|
}
|
|
}
|