Can i use filament form getters and setters in custom page?

Forms\Components\Grid::make()
->schema([
Forms\Components\Select::make('from_warehouse_id')
->label(self::$resource::$langFile . '.warehouse')
->options(fn () => Warehouse::pluck('name', 'id'))
->live()
// ->searchable()
->required(),
Forms\Components\Select::make('to_warehouse_id')
->label(self::$resource::$langFile . '.warehouse')
->options(fn (Forms\Get $get) => Warehouse::pluck('name', 'id')->filter(fn ($value, $key) => $key != $get('from_warehouse_id')))
->disabled(fn(Forms\Get $get) => dd($get('*', true)))
// ->disabled(fn(Forms\Get $get) => !filled($get('from_warehouse_id')))
// ->searchable()
->required(),
]),
Forms\Components\Grid::make()
->schema([
Forms\Components\Select::make('from_warehouse_id')
->label(self::$resource::$langFile . '.warehouse')
->options(fn () => Warehouse::pluck('name', 'id'))
->live()
// ->searchable()
->required(),
Forms\Components\Select::make('to_warehouse_id')
->label(self::$resource::$langFile . '.warehouse')
->options(fn (Forms\Get $get) => Warehouse::pluck('name', 'id')->filter(fn ($value, $key) => $key != $get('from_warehouse_id')))
->disabled(fn(Forms\Get $get) => dd($get('*', true)))
// ->disabled(fn(Forms\Get $get) => !filled($get('from_warehouse_id')))
// ->searchable()
->required(),
]),
when dumping all get values i get null
>disabled(fn(Forms\Get $get) => dd($get('*', true)))
>disabled(fn(Forms\Get $get) => dd($get('*', true)))
Solution:
https://www.youtube.com/watch?v=8Di6Yrqgsl8 The custom page was not configured correctly i followed this tutorial and every thing worked fine...
Filament Daily
YouTube
Filament: Only Edit Form with Custom Page and Livewire
If you want to use a Filament form outside of the Resource, here's one example. Original tutorial. Filament: Edit Only Single Record with Custom Page https://laraveldaily.com/post/filament-edit-only-single-record-custom-page
Jump to solution
2 Replies
hrank8t
hrank8t7mo ago
To debug try to use afterStateUpdated(State $state, Get $get) in the Select. Ex: dd($get('from_warehouse_id'));
Solution
A7med_khalid
A7med_khalid7mo ago
https://www.youtube.com/watch?v=8Di6Yrqgsl8 The custom page was not configured correctly i followed this tutorial and every thing worked fine
Filament Daily
YouTube
Filament: Only Edit Form with Custom Page and Livewire
If you want to use a Filament form outside of the Resource, here's one example. Original tutorial. Filament: Edit Only Single Record with Custom Page https://laraveldaily.com/post/filament-edit-only-single-record-custom-page
Want results from more Discord servers?
Add your server