Trying to call a view of another resource from a table
I am trying to call laptop assignment view from laptop table action.
Tables\Actions\ViewAction::make()
->url(fn ($record) => route('filament.resources.laptop-assignments.create', ['record' => $record]))
])
But i always get that the route is not defined. How can i make it work?
2 Replies
The create route doesn't accept a record parameter. Also if you do your routes like
LaptopAssignmentsResource::getUrl('create', ['record_id' => $record->id])
you are less dependent on the actual route
If you want to create that resource while referencing this record you can maybe provide a query parameter record ID to the create route.You should use the getUrl() method on the resource instead of the route name, but the data doesn’t make sense in this case. It only makes sense in an edit context.