$ingredients = Cache::remember('ingredients_list', 60, function () {
return Ingredient::all()->pluck('name', 'id')->toArray();
});
//
->actions([
// ...
Tables\Actions\EditAction::make()
->form([
Forms\Components\Select::make('name')
->searchable()
->options($ingredients),
Forms\Components\TextInput::make('quantity')->required(),
Select::make('unit')
->label('Unit')
->options(Unit::query()->pluck('unit', 'symbol'))
->required(),
]),
Tables\Actions\DetachAction::make()
->modalHeading('Remove Ingredient')
->modalIcon('heroicon-o-trash')
->label('Remove'),
])
$ingredients = Cache::remember('ingredients_list', 60, function () {
return Ingredient::all()->pluck('name', 'id')->toArray();
});
//
->actions([
// ...
Tables\Actions\EditAction::make()
->form([
Forms\Components\Select::make('name')
->searchable()
->options($ingredients),
Forms\Components\TextInput::make('quantity')->required(),
Select::make('unit')
->label('Unit')
->options(Unit::query()->pluck('unit', 'symbol'))
->required(),
]),
Tables\Actions\DetachAction::make()
->modalHeading('Remove Ingredient')
->modalIcon('heroicon-o-trash')
->label('Remove'),
])