-
I noticed that filament already hides the edit button and disabled the click on the table for rows which the current user do have have permission to edit or view when a policy is set for that model. Instead I want to remove those rows from the table completely. Is there a way to do that with filament without manually applying scopes to the model based on current user role or permission? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
It's much better to add the scope to the Eloquent query, since looping through records to check for permissions is not performant. |
Beta Was this translation helpful? Give feedback.
-
If you need more control over how the rows are filtered, you can use a custom query closure. For example, you could use a closure to filter the rows based on the current user's role: public static function table(Table $table) |
Beta Was this translation helpful? Give feedback.
It's much better to add the scope to the Eloquent query, since looping through records to check for permissions is not performant.