Filter records based on Nova Permissions #12
Replies: 7 comments
-
Good point, I agree that this should be the default behavior. I'd say the place to implement this is in So in
|
Beta Was this translation helpful? Give feedback.
-
NB maybe it is desirable to be able to show events in the calendar to users even though their policy disallows viewing or editing the related model. For those cases the |
Beta Was this translation helpful? Give feedback.
-
I have just released 1.3 that automatically excludes events from the calendar if the current user doesn't have Instead of implementing the aforementioned |
Beta Was this translation helpful? Give feedback.
-
Hello, sorry in advance if that's the wrong place to submit this, i was thinking, is it possible to filter the records by using a where statement? More specifically i want to filter them by a category attribute (my resource is inspection and i want each user to see only his own inspections so something like
|
Beta Was this translation helpful? Give feedback.
-
That's what the exclude method on your I think in your case you could implement it like this;
|
Beta Was this translation helpful? Give feedback.
-
By the way, an easier and more general solution in your case would be to implement the Laravel policies for |
Beta Was this translation helpful? Give feedback.
-
That's great thank you so much for the quick response, all the best!! :) |
Beta Was this translation helpful? Give feedback.
-
Currently, nova lists all records of a selected resource.
But a User might not be able to view all records, or view any record for that matter based on Laravel Policies that Nova respects. The package should apply
viewAny
andview
permissions from a model policy.Not sure how to achieve this yet but I'll figure it out and create a PR
Beta Was this translation helpful? Give feedback.
All reactions