lundi 6 mai 2019

How to apply query variable to whereHas closure?

I have a query stored in a variable.

how to apply this variable to whereHas closure?

$productQuery = ...; // complex query comes from another class

return CategoryModel::whereHas('products', function ($query) use($productQuery) {
    $query->apply($productQuery) // I need to apply product query here but Laravel has not this method
})->get();



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire