© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
19 replies
Crylar

How to pass parameters from ListRecords to CreateRecord in Resources?

I have the following relations Menus > Categories > Products. I have
ListProducts
ListProducts
where I do allow user to choose a
Menu
Menu
from a dropdown and picked
menu_id
menu_id
is saved via a
$queryString
$queryString
. So now when I click on a Create action I would like to carry this
menu_id
menu_id
to the Create page and display related Categories to the user when creating + keeping him in the same Menu. Any best practices on of how to achieve this in Filament?

class ListProducts extends ListRecords
{
    protected static string $resource = ProductResource::class;

    public Collection $menus;

    public ?int $menu = null;

    protected $queryString = [
        'menu'
    ];
    public function mount(): void
    {
        parent::mount();

        $this->menus = Menu::with('products')->get();
    }

    protected function getActions(): array
    {
        return [
            Actions\SelectAction::make('menu')
                ->options($this->menus->pluck('title', 'id')->toArray()),

            Actions\CreateAction::make(),
        ];
    }

    .....
class ListProducts extends ListRecords
{
    protected static string $resource = ProductResource::class;

    public Collection $menus;

    public ?int $menu = null;

    protected $queryString = [
        'menu'
    ];
    public function mount(): void
    {
        parent::mount();

        $this->menus = Menu::with('products')->get();
    }

    protected function getActions(): array
    {
        return [
            Actions\SelectAction::make('menu')
                ->options($this->menus->pluck('title', 'id')->toArray()),

            Actions\CreateAction::make(),
        ];
    }

    .....
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

how to pass in parameters into custom column
FilamentFFilament / ❓┊help
3y ago
Get extra parameters from URL for resources
FilamentFFilament / ❓┊help
3y ago
'Filament\Resources\Pages\ListRecords\Tab' is deprecated
FilamentFFilament / ❓┊help
3y ago
Need Help, how pass parameters to relation manager?
FilamentFFilament / ❓┊help
15mo ago