Answer the question
In order to leave comments, you need to log in
Laravel. Is it possible to add dynamic parameters to GlobalScope?
Problem. I have an aggregation model consisting of data from several tables, part of the data is calculated in the query itself in the database. To be sure that the model will always have all the necessary data, you can use a global scope when calling the model, instead of writing a local scope (in which to pass parameters) each time the model is called.
But the question is how to throw dynamic parameters into the global scope itself? Perhaps there is a more convenient solution?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question