-1
A doubt of structure.
Scenario: I have 3 users: administrator, stores, customers.
I have a product model and I want to define a global Cope in it so that when stores access the product listing the query already brings the products from this store (without me having to spend Where on hand in all listings).
But if I set this global Cope in my product model will give off when I try to access the general product listing when logged in to the administrator.
What’s the best way to do it? I put an if in globalscope checking which user is accessing to know whether or not I should use this globalscope, or I create 2 models of products and use them separately for each user?
And a second question, if some of my functions even in the store user is not necessary to use the global Cope, what do I do? (knowing that most functions are necessary to use).
Possible duplicate of How to set up an Anonymous Global Scopes in Laravel?
– novic