Global Scope: but it will add scopes to a static and it will apply until the end of the process.
Local Scope: and it seems to have to write those in Model Class.
My problem is:
I want a separate Scope class just like Global Scope
I can apply it to model temporary, and I can set/get the scope instance.
My project is multiple modules, in each module will have some scopes. My Model could pick scopes depends on the context. So I don't want to write scopes in Model.
Example:
$exampleScope = new ExampleScope();
$exampleScope->setSomething('123');
$model = new Model();
$data = $model->newQuery()->applyScope($exampleScope)->get();
But I can make a macro to achieve this. How do you guys think about this?
Hope you guys could support me this issue. Many thanks.
Hello,
Laravel has:
My problem is:
Example:
But I can make a macro to achieve this. How do you guys think about this?
Hope you guys could support me this issue. Many thanks.