- 新增3个migration(15张表): service/nanny/inventory - 新增15个Model + 13个Controller - 新增55条API路由(总计212条) - 新增3个前端API模块 + 11个管理页面 - vite build验证通过
16 lines
915 B
PHP
16 lines
915 B
PHP
<?php
|
|
namespace App\Models\Service;
|
|
use App\Models\Crm\Customer;
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
class ServiceExecution extends Model
|
|
{
|
|
protected $fillable = ['service_order_id','service_item_id','customer_id','technician_id','scheduled_at','started_at','ended_at','status','remark'];
|
|
protected function casts(): array { return ['scheduled_at'=>'datetime','started_at'=>'datetime','ended_at'=>'datetime','status'=>'integer']; }
|
|
public function order(): BelongsTo { return $this->belongsTo(ServiceOrder::class, 'service_order_id'); }
|
|
public function serviceItem(): BelongsTo { return $this->belongsTo(ServiceItem::class); }
|
|
public function customer(): BelongsTo { return $this->belongsTo(Customer::class); }
|
|
public function technician(): BelongsTo { return $this->belongsTo(User::class, 'technician_id'); }
|
|
}
|