modifyQueryUsing based on request - action resets query
Hey all,
Use case:
- In the /view it gets all categories that don't have parent ids
- When you click on a record it takes you to route /{record}/view
- In /{record}/view it fetches all subcategories where parent_id = {record}
Problem:
- In /{record}/view when I click on a Table action, the query resets and the action doesn't perform.
Here's the code:
I'm wondering if I'm doing anything wrong or approaching the wrong way.
Thanks!
Solution:Jump to solution
Add a
$record
property to your ListProductCategories page (not resource) because that es what you named to param.6 Replies
You should never rely on
request()
in Livewire context. Use a property on the Livewire component instead.Thanks @Dennis Koch
In the context of a Filament resource, what property would you suggest we use to check if a $record is set? ππ»
In the context of a Filament resource, what property would you suggest we use to check if a $record is set? ππ»
Solution
Add a
$record
property to your ListProductCategories page (not resource) because that es what you named to param.Use
$livewire->record
inside the Closure then.Gotchyaaa ππ» will provide feedback later. Thanks!
Worked like a charm @Dennis Koch πͺπ»