F
Filament15h ago
morty

Is there a way to evaluate this immediately without returning a closure?

I want to return an array here but I also need to check the operation of the form if it's in create or edit. I don't want to return a closure because it's slower due to querying the database when the user focuses the field. I'd rather load these on page load which returning an array would do.
Forms\Components\Select::make('priority')->options(fn (string $operation) => WorkOrderStatus::options($operation))
Forms\Components\Select::make('priority')->options(fn (string $operation) => WorkOrderStatus::options($operation))
3 Replies
morty
mortyOP15h ago
Probably more of a PHP question than a Filament one but thought i'd ask anyway
charlie
charlie15h ago
with two fields with hiddenOn('create') or hiddenOn('edit')?
morty
mortyOP15h ago
ah gotcha, ya I didn't think of that

Did you find this page helpful?