At the moment i have Query inside my Controller method made using Query Builder. Like so:
public function postFilters(){
$filt = Input::get('name');
$query = DB::table('wm.top_pages')->where('filter',$filt)->limit(20)->get();
return View::make('topPages.table', ['wm'=>$query]);
}
I would like to get the query outside of Controller and into my Model. But everytime i do this, i get an error because the same query as above, but now inside my model does not recognize the variable $filt, which actually gotten from my View. Can anyone advise on how to go about this? What i have done above is actually not what MVC should look like and i'm assuming there are ways of getting around it. I just cant make sense of most of the documentation on this specific topic.
Thanks a lot.