Access model $record issue in Select (pluck)
I am trying the following:
I want to select only the related recipe stages according to the recipe_id, this is inside a RecipeResource, inside an IngredientsRelationsManager.
'''
->form(fn (AttachAction $action): array => [
Forms\Components\Select::make('recipe_stage_id')
->placeholder('Select Stage')
->columnSpan(1)
->required()
->options((fn (Recipe $record) => RecipeStage::where('recipe_id', $record->id)->pluck('name', 'id')->toArray())),
......
'''
error:
Argument #1 ($record) must be of type App\Models\Recipe, null given,
3 Replies