How to show a table with only records that belong to the authenticated user?

Hi, I'm building a sample Filament site to practice and learn. I'm stuck on how I can make a resource only show records that belong to the authenticated user. For example, in my products table, I have a user_id column. I only want to show records that match user_id with auth()->user()->id in my Filament table.
Solution:
An other, more localised option would be setting the resource query
Jump to solution
6 Replies
Xeretis
Xeretis13mo ago
Hey One way to solve this would be with using global scopes
Xeretis
Xeretis13mo ago
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
Xeretis
Xeretis13mo ago
Filament will use all global scopes by default
Solution
Xeretis
Xeretis13mo ago
An other, more localised option would be setting the resource query
BuddhaNature
BuddhaNatureOP13mo ago
Exactly what I was looking for. Thank you.
Want results from more Discord servers?
Add your server