- 新增3个migration(9张表): office(6表)/report(1表)/kb(2表) - 新增9个Model + 9个Controller - 新增43条API路由(总计305条) - 新增3个前端API模块 + 10个管理页面 - 迁移运行通过, vite build验证通过
44 lines
1005 B
PHP
44 lines
1005 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;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class Approval extends Model
|
|
{
|
|
use BelongsToStore;
|
|
|
|
protected $fillable = [
|
|
'store_id', 'template_id', 'title', 'applicant_id', 'form_data',
|
|
'status', 'current_node', 'related_type', 'related_id',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'status' => 'integer',
|
|
'current_node' => 'integer',
|
|
'form_data' => 'array',
|
|
];
|
|
}
|
|
|
|
public function template(): BelongsTo
|
|
{
|
|
return $this->belongsTo(ApprovalTemplate::class, 'template_id');
|
|
}
|
|
|
|
public function applicant(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'applicant_id');
|
|
}
|
|
|
|
public function nodes(): HasMany
|
|
{
|
|
return $this->hasMany(ApprovalNode::class);
|
|
}
|
|
}
|