Files
x-server-mobile/backend/app/model/ApprovalFlow.php
T
root 66b61eada4 refactor: 使用官方support\Db和support\Model
- 创建 support/Db.php 和 support/Model.php
- 在 bootstrap.php 中自动初始化数据库
- 移除 app/util/Db.php
- 更新所有模型和控制器使用官方类

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:15:17 +08:00

48 lines
884 B
PHP

<?php
namespace app\model;
use support\Model;
class ApprovalFlow extends Model
{
protected $table = 'approval_flow';
protected $fillable = [
'business_type',
'name',
'description',
'status',
];
protected $casts = [
'status' => 'integer',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
/**
* 关联审批节点
*/
public function nodes()
{
return $this->hasMany(ApprovalNode::class, 'flow_id')->orderBy('order');
}
/**
* 获取启用的流程
*/
public function scopeActive($query)
{
return $query->where('status', 1);
}
/**
* 根据业务类型获取流程
*/
public function scopeByBusinessType($query, string $businessType)
{
return $query->where('business_type', $businessType);
}
}