Search code examples
phplaravellaravel-filamentfilamentphp

How to pass route parameters in FilamentPHP?


I wanted to pass station id when creating an episode. I did the following changes to my EpisodeResource file.

            'edit' => Pages\EditEpisode::route(
                '/{station}/{record}/edit'
            ),

The problem with this is that even though my Create & Edit route changed but I cannot update or create operations. Seems like POST request to /livewire/update doesn't consider the station id.

Should I change it to http query request?


Solution

  • I have several solutions:

    1. Did you consider RelationManager. I think, it is a simple and easy to manager relations. it is only required to declare relationships in your model.
    2. FilamentDaily solution is Nested resources. They did it like you ask. (I think)
    3. You can use Filament repeater. you can use it as dynamic field for relationship or (like WordPress custom field/ACF).
    4. Dynamic fields to generate array with it you can save several independent content or json content in your database.

    I worked with Filament and am really like it. Hope it is help you.