Contohnya seperti ini:


$searchResult=DB::table('books')->join('apartments', 'apartment_id', '=', 'apartments.id')
->where('col1','=','foobar')
->where(function($queryContainer){
$queryContainer->where(function($query){
$query->where('date_ini', 'where('date_fin','>', Input::get( 'desdeGet' ));
})
->orwhere(function($query){
$query ->where('date_ini', 'where('date_fin', '>=', Input::get( 'hastaGet' ));
})
->orwhere(function($query){
$query->where('date_ini', '>=', Input::get( 'desdeGet' ))
->where('date_fin', 'paginate(2);

Source: laravel query builder enclose complex where – Stack Overflow

Advertisements