Reputation: 2199
I don't know if 'arguments' is the right term. I want to get a model without everything and add the selects
and wheres
later.
$query = Pic::;
if($cat) $query->where('cat',$cat);
if($year) $query->where('jahrprod',$year);
$query->get();
Pic::
or Pic
don't work. Only DB::table('pics')
does, but does not seem to return a collection.
Upvotes: 0
Views: 429
Reputation: 13325
Use Model::query();
$query = Pic::query();
if($cat) $query->where('cat',$cat);
if($year) $query->where('jahrprod',$year);
$query->get();
Upvotes: 1