Carlinhos
How can I use Laravel ENUM in the Filement table?
how can I use Laravel's ENUM in the Filement table and form?
I'm doing it this way, but is there a better way to do it?
In Form:
Forms\Components\Select::make('status')
->label('Status')
->options([
'awaiting_evaluation' => ServiceStatus::AwaitingEvaluation->label(),
'approved' =>
ServiceStatus::Approved->label(),
'awaiting_payment' =>
ServiceStatus::AwaitingPayment->label(),
'device_collected' =>
ServiceStatus::DeviceCollected->label(),
])
->default('awaiting_evaluation')
->required(),
In Table:
Tables\Columns\SelectColumn::make('status')
->label('Status')
->options([
'awaiting_evaluation' => ServiceStatus::AwaitingEvaluation->label(),
'approved' =>
ServiceStatus::Approved->label(),
'awaiting_payment' =>
ServiceStatus::AwaitingPayment->label(),
'device_collected' =>
ServiceStatus::DeviceCollected->label(),
])
->selectablePlaceholder(false)
->sortable()
->searchable(),
In Form:
Forms\Components\Select::make('status')
->label('Status')
->options([
'awaiting_evaluation' => ServiceStatus::AwaitingEvaluation->label(),
'approved' =>
ServiceStatus::Approved->label(),
'awaiting_payment' =>
ServiceStatus::AwaitingPayment->label(),
'device_collected' =>
ServiceStatus::DeviceCollected->label(),
])
->default('awaiting_evaluation')
->required(),
In Table:
Tables\Columns\SelectColumn::make('status')
->label('Status')
->options([
'awaiting_evaluation' => ServiceStatus::AwaitingEvaluation->label(),
'approved' =>
ServiceStatus::Approved->label(),
'awaiting_payment' =>
ServiceStatus::AwaitingPayment->label(),
'device_collected' =>
ServiceStatus::DeviceCollected->label(),
])
->selectablePlaceholder(false)
->sortable()
->searchable(),
6 replies