Advertisement
Guest User

Laravel Query Builder

a guest
Apr 22nd, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.31 KB | None | 0 0
  1. DB::table('table')
  2.   ->where(function($q) {
  3.       $q->whereBetween('from_date', ['from', 'to']);
  4.     })
  5.   ->orWhere(function($q) {
  6.       $q->whereBetween('to_date ', ['from', 'to']);
  7.     })
  8.   ->orWhere(function($q) {
  9.      $q->where('from_date', '<=', 'from')
  10.         ->where('to_date', '>=', 'to');    
  11.     });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement