You can use whereRaw() to add a raw where clause to the query, for example:
$results = SpPrice::whereRaw("('2014-08-15' between `from_date` and `to_date`) || ('2014-09-18' between `from_date` and `to_date`)")->get();
Or maybe you can use DB::raw() as the first argument to whereBetween() , but I'm not sure if this is possible, in this case you can use orWhere() with closure to write more readable code, for example
SpPrice::whereBetween(DB::raw('"2014-08-15"'), ['from-date', 'to_date'])->orWhere(function($q) { $q->whereBetween(DB::raw('"2014-09-18"'), ['from-date', 'to_date']); });
But I'm not quite sure if this works, give it a try.
Sahib J. leo
source share