orchidsoftware / crud

Simplify the process of building CRUD (Create, Read, Update, Delete) functionality in Laravel using the features of Orchid.
https://orchid.software
MIT License
137 stars 34 forks source link

View own records only on table #72

Closed Uceef94 closed 2 years ago

Uceef94 commented 2 years ago

Hello,

I'm using this package with policies and everything works fine, except that everyone can see the data on table of the resource. Does anyone knows how to let users see only their own data?

Uceef94 commented 2 years ago

in case someone had the same issue you can resolve it by overriding the method paginateQuery() in your resource and do your logic there.

public function paginationQuery(ResourceRequest $request, Model $model): Builder
{
     return $model->query();
}