ReimbursementStatus::Pending, ]; protected $casts = [ 'reimbursement_status' => ReimbursementStatus::class, ]; protected $fillable = [ 'employee_id', 'reimbursement_type_id', 'expense', 'reason', 'photos', 'reimbursement_status', ]; public function employee(): BelongsTo { return $this->belongsTo(Employee::class); } public function type(): BelongsTo { return $this->belongsTo(Keyword::class, 'reimbursement_type_id', 'key'); } /** * 是否是待审核 */ public function isPending(): bool { return $this->reimbursement_status === ReimbursementStatus::Pending; } protected function photos(): Attribute { return Attribute::make( get: function (mixed $value) { if (! is_array($photos = json_decode($value ?? '', true))) { $photos = []; } return $photos; }, set: fn (mixed $value) => json_encode(is_array($value) ? $value : []), ); } }