'datetime', ]; /** * 操作类型常量 */ const ACTION_SUBMIT = 'submit'; // 提交 const ACTION_APPROVE = 'approve'; // 通过 const ACTION_REJECT = 'reject'; // 拒绝 const ACTION_CANCEL = 'cancel'; // 撤销 /** * 关联审批单 */ public function order() { return $this->belongsTo(ApprovalOrder::class, 'order_id'); } /** * 关联审批人 */ public function approver() { return $this->belongsTo(User::class, 'approver_id'); } /** * 判断是否是批准操作 */ public function isApproved(): bool { return $this->action === self::ACTION_APPROVE; } /** * 判断是否是拒绝操作 */ public function isRejected(): bool { return $this->action === self::ACTION_REJECT; } }