Is there an easy way to create search queries from objects in laravel

58 views Asked by At

I'm looking for a way to translate a query tree object that may look like:

 [Or => [And => [userid => 4,albumid =>23], And [.....] ,...]]

Into a laravel query

return $query->orWhere(function($query() { 
         return $query->where('userid', 4)
              ->where('albumid', 23);
    } )->orWhere(.....)

I wanted to know if something like this exists before I reinvent the wheel....

0

There are 0 answers