You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to create button in the top header of the Resource. I added new action in getHeaderActions() of the ListRecords class. There is a textarea and a dropdown. The dropdown is of Forms\Components\Select and configured to use relationship:
Action::make('AddRelation')
->form([
Forms\Components\Textarea::make('text')
->required(),
Forms\Components\Select::make('relation_id')
->relationship('relationship', 'name')
->preload()
->multiple()
->maxItems(1)
])
->action(function (array$data): void {
//`text` is here, but `relation_id` is not.dd($data);
})
Expected behavior
action() should receive all user entered form data regardless of the input type.
Steps to reproduce
Setup environmet
composer install
php artisan migrate
php artisan db:seed
php artisan make:filament-user - create user as requested
Log into panel, navigate to "Relations"
Click on "Add test"
Fill the form and submit. You can see that there only will be data from textarea.
Form components using relationship() are designed not to dehydrate into $data so that you can save that data to the main model out of the box. When calling ->saveRelationships() or when your action is associated with a record, it will save the data for you.
If you add ->dehydrated() onto that Select after ->relationship(), it should work.
Package
filament/filament
Package Version
v3.2.50
Laravel Version
v10.48.3
Livewire Version
v3.4.9.
PHP Version
8.2
Problem description
I want to create button in the top header of the Resource. I added new action in getHeaderActions() of the ListRecords class. There is a textarea and a dropdown. The dropdown is of
Forms\Components\Select
and configured to use relationship:Expected behavior
action()
should receive all user entered form data regardless of the input type.Steps to reproduce
composer install
php artisan migrate
php artisan db:seed
php artisan make:filament-user
- create user as requestedReproduction repository
https://github.com/webmasterlv/filament-test.git
Relevant log output
No response
The text was updated successfully, but these errors were encountered: