public $status
->default(function () use ($record): ?int { if ($record->status !== null) { return $record->status; } $enabledStatuses = Status::where([ 'status_id' => $record->status_id, 'enabled' => true, ])->get('id'); if ($enabledStatuses->count() === 1) { return $enabledStatuses->first()->id; } return null; })