41 lines
1016 B
PHP
41 lines
1016 B
PHP
<?php
|
|
|
|
namespace App\Modules\Maintenance\Models;
|
|
|
|
use App\Business;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class PartCatalog extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'maintenance_part_catalogs';
|
|
|
|
protected $fillable = [
|
|
'business_id', 'catalog_code', 'name', 'manufacturer', 'manufacturer_part_number',
|
|
'part_type', 'is_consumable', 'description', 'specifications',
|
|
'default_replacement_interval_days', 'is_oem', 'equivalent_parts', 'status',
|
|
];
|
|
|
|
protected $casts = [
|
|
'is_consumable' => 'boolean',
|
|
'is_oem' => 'boolean',
|
|
'specifications' => 'array',
|
|
'equivalent_parts' => 'array',
|
|
];
|
|
|
|
protected static function booted(): void
|
|
{ }
|
|
|
|
public function business()
|
|
{
|
|
return $this->belongsTo(Business::class);
|
|
}
|
|
|
|
public function documents()
|
|
{
|
|
return $this->morphMany(AssetDocument::class, 'documentable')->orderBy('sort_order');
|
|
}
|
|
}
|