Forked from anonymous/gist:0eb25d2fe5f3b702e9096c4ec2ac65e8
Created
July 27, 2016 07:23
-
-
Save kevsersrca/e6f738956cb585bb685d35485ea86672 to your computer and use it in GitHub Desktop.
filter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Post::whereHas('tags', function ($query) use ($t) { | |
$query->where('tag_id','=', $t); | |
})->whereHas('languages', function ( $query ) use ( $l ){ | |
$query->where('language_id', '=',$l); | |
})->orWhere(function ($q) use ($search) { | |
$q->where('title', 'LIKE', '%' . $search . '%') | |
->orWhere('explanation','LIKE','%'.$search.'%') | |
->orWhere('usage','LIKE','%'.$search.'%') | |
->orWhere('codeexample','LIKE','%'.$search.'%') | |
->orderBy('id','desc'); | |
})->get(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment