Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Haseeb69's avatar

Laravel Spatie Info

i'm new to laravel and i've come across a project where i have to use roles and permissions

My project focusses on subscription based search functionalities

E.g Out of 50 states user can have access to particular 2 or 3 states and same for another kind of category while searching

i've read spatie's documentation but i have some confusions

  1. What would be the logic for this kind of search . if i make user as a role and permissions as (search_state1,search_state2 etc ) would that be correct or im totally wrong .

2 . can permissions be assigned to a particular user ? ( e.g user 1 can search only 2 states while user 2 can search 4 states etc)

0 likes
3 replies
Haseeb69's avatar

I mean i have a search functionality where user can select multiple states and multiple categories I wanna know what logic can i make regarding this It's a subscription based search so user with standard sub are allowed to only search in particular 2 states e.g california and new york etc and only two categories like sports or e gaming etc

tykus's avatar

I don’t know that permissions are the answer here; you would need a separate config to scope queries to the users’ states. And the permissions and that confit could fall out of sync.

Without code it is difficult to help; but I would suggest you consider a pivot table to map a User to their permitted States so the search can be constrained

Please or to participate in this conversation.