false, 'complaint_status' => ComplaintStatus::Pending, ]; protected $casts = [ 'anonymous' => 'bool', 'complaint_status' => ComplaintStatus::class, ]; protected $fillable = [ 'employee_id', 'content', 'photos', 'result', 'anonymous', 'complaint_status', ]; public function employee(): BelongsTo { return $this->belongsTo(Employee::class); } public function isPending(): bool { return $this->complaint_status === ComplaintStatus::Pending; } public function isProcessing(): bool { return $this->complaint_status === ComplaintStatus::Processing; } 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 : []), ); } }