FilamentF
Filamentβ€’2y ago
Alexandre

$get() in Wizard Form is null

Hi all !
I have the same problem as this topic : Can't access data with $get between Wizard steps
In my case, I've a Select form in the first step where the user choose a building (or can create new one) :

Wizard::make([
    Step::make('step_1')
        ->label(...)
        ->schema([
            Select::make('building')
                ->label(...)
                ->options(..)
                ->native(false)
                ->searchable()
                ->allowHtml()
                ->required()
                ->createOptionForm(...)
                ->createOptionModalHeading(...)
                ->createOptionUsing(...)
                ->live()
        ])


On step 2, I have another select in a repeater where I want to use the ID of the building field (step 1) to make a query search. So, I use Get $get for that :

Step::make('step_2')
    ->label(...)
    ->schema([
        Repeater::make('products')
                ->label(...)
                ->schema([
                    Section::make('key')
                        ->schema([
                            Select::make('card_number')
                                ->getSearchResultsUsing(function (
                                    string $search,
                                    Get $get
                                ): array {
                                    dd($get('building')); //return null
                                })
                                ->columnSpanFull(),


The $get return null. If I do a $get of another field on the current step, it's work.
Is there anything special I need to do to retrieve the field value in a repeater and form wizard?
Thanks in advance πŸ™‚
Solution
because I made a typo!

data_get($livewire->data, 'building')
Was this page helpful?