58 lines
1.1 KiB
PHP
58 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Modules\Maintenance\Models;
|
|
|
|
use App\Business;
|
|
use App\User;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class HistoryEntry extends Model
|
|
{
|
|
protected $table = 'maintenance_history_entries';
|
|
|
|
protected $fillable = [
|
|
'business_id',
|
|
'equipment_id',
|
|
'entry_type',
|
|
'title',
|
|
'description',
|
|
'metadata',
|
|
'cost',
|
|
'performed_by',
|
|
'performed_at',
|
|
'related_type',
|
|
'related_id',
|
|
'attachments',
|
|
];
|
|
|
|
protected $casts = [
|
|
'metadata' => 'array',
|
|
'cost' => 'integer',
|
|
'performed_at' => 'datetime',
|
|
'attachments' => 'array',
|
|
];
|
|
|
|
protected static function booted(): void
|
|
{ }
|
|
|
|
public function business()
|
|
{
|
|
return $this->belongsTo(Business::class);
|
|
}
|
|
|
|
public function equipment()
|
|
{
|
|
return $this->belongsTo(Equipment::class, 'equipment_id');
|
|
}
|
|
|
|
public function performer()
|
|
{
|
|
return $this->belongsTo(User::class, 'performed_by');
|
|
}
|
|
|
|
public function related()
|
|
{
|
|
return $this->morphTo();
|
|
}
|
|
}
|