One way to do it
$filters = Input::all();
return Post::where(function($query) use ($filters){
foreach ((array)$filters as $key=>$value){
if ($value){
$query->where($key, '=', $value);
}
}
})->get()
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community