FilamentF
Filament3y ago
Eth

issue with pluck() on array

I’m trying to display a list of options according to the place name from database (option from options -json- as you could see in the image)
But it’s showing me the error message “Call to a member function pluck() on array

Code:
Forms\Components\Select::make('placeName')
                ->label('Place Name')
                ->required()
                ->live()
                ->searchable()
                ->options(Place::all()->pluck('placeName'))
                ->afterStateUpdated(function ($state, callable $set, callable $get){
                        $place = $get('placeName');
                        $placePrice = Place::find($place)->placePrice;
                        $placeOptions = Place::find($place)?->options->pluck('option');
                        $set('totalPrice', $placePrice);
                        $set('options', $placeOptions);
                    })
IMG_2526.jpg
Was this page helpful?