- 新增3个migration(9张表): office(6表)/report(1表)/kb(2表) - 新增9个Model + 9个Controller - 新增43条API路由(总计305条) - 新增3个前端API模块 + 10个管理页面 - 迁移运行通过, vite build验证通过
41 lines
931 B
PHP
41 lines
931 B
PHP
<?php
|
|
|
|
namespace App\Models\Office;
|
|
|
|
use App\Models\User;
|
|
use App\Traits\BelongsToStore;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class Handover extends Model
|
|
{
|
|
use BelongsToStore;
|
|
|
|
const UPDATED_AT = null;
|
|
|
|
protected $fillable = [
|
|
'store_id', 'shift_date', 'shift_type', 'handover_user_id',
|
|
'receiver_user_id', 'content', 'issues', 'status', 'confirmed_at',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'shift_type' => 'integer',
|
|
'status' => 'integer',
|
|
'shift_date' => 'date',
|
|
'confirmed_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function handoverUser(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'handover_user_id');
|
|
}
|
|
|
|
public function receiverUser(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'receiver_user_id');
|
|
}
|
|
}
|