41 lines
849 B
PHP
41 lines
849 B
PHP
<?php
|
|
|
|
namespace Modules\Maintenance\Models;
|
|
|
|
use App\Business;
|
|
use App\User;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class MaintenanceApproval extends Model
|
|
{
|
|
protected $table = 'maintenance_approvals';
|
|
|
|
protected $fillable = [
|
|
'business_id', 'approvable_type', 'approvable_id', 'approval_type',
|
|
'signature_data', 'photo_path', 'approver_id', 'approver_name', 'approver_role',
|
|
'approved_at', 'notes',
|
|
];
|
|
|
|
protected $casts = [
|
|
'approved_at' => 'datetime',
|
|
];
|
|
|
|
protected static function booted(): void
|
|
{ }
|
|
|
|
public function business()
|
|
{
|
|
return $this->belongsTo(Business::class);
|
|
}
|
|
|
|
public function approvable()
|
|
{
|
|
return $this->morphTo();
|
|
}
|
|
|
|
public function approver()
|
|
{
|
|
return $this->belongsTo(User::class, 'approver_id');
|
|
}
|
|
}
|