F
Filamentβ€’4w ago
frame

Adding where clause to query using current session

Can I always filter UserResource rows to only rows that belong to the same group as the current logged in user ($query->where('group_id', auth()->user()->group_id)? Where would I apply such a where clause? getTableQuery says deprecated β€” Override the table() method to configure the table so I'm not sure how to do it πŸ€”
Solution:
Possibly working with $table->modifyQueryUsing(function (Builder $query) {}) πŸ€”
Jump to solution
2 Replies
Solution
frame
frameβ€’4w ago
Possibly working with $table->modifyQueryUsing(function (Builder $query) {}) πŸ€”
toeknee
toekneeβ€’4w ago
That is correct yes. But ideally you should be using a scope on the model usually.

Did you find this page helpful?