$keywords_array = explode(' ',Input::get('keywords')); 
$picture = DB::table('pictures')
    ->join('pictures_category', 'pictures.category', '=', 'pictures_category.id')
    ->select('pictures.*', 'pictures_category.name as category_name')
    ->orderBy('pictures.id','desc')
    ->where('pictures.erp_sku', Input::get('keywords'))
    ->orWhere(function($q) use ($keywords_array){
        foreach($keywords_array as $value){
            $q->Where('pictures.name', 'like', "%{$value}%");
        }
    })
    ->paginate('20');

results matching ""

    No results matching ""