Edit page as Index resource page
I have a resource that I want users to only edit. It doesn't make sense to show an index page with a list of resources. Therefore, I would like the "Tenant" menu, for example, to directly open the edit page with the form to make changes.
I could not set the Pages with the ID because I have no information about session at this point.
Normal resource:
I want to do something like:
I've attempted to use custom pages that extend from Page and fill on mount function, but it returns errors.
Missing required parameter for [Route: filament.user.resources.teams.index] [URI: teams/{record}/edit] [Missing parameter: record].
It's because when Panel is mounted, doesn't have information about which ID Tenant will edit.2 Replies
I've already tried passing "wrong" id on route and fix on mount() function with session information, but returns error before mount execute.
Unable to resolve dependency [Parameter #0 [ <required> string|int $record ]] in class App\Filament\User\Resources\TeamResource\Pages\EditTeam
Found a solution.
Late to the party but I found a solution to this question/challenge. In the Resource file I changed the
getPages()
method to this:
Then in the EditThings
class I defined the mount()
method like so:
The trick is to assign a default value of null
to the required parameter.