use Carbon/Carbon;
use {model_namespace}/Banner;
$banner = Banner::where('valid_from', '<=', Carbon::createFromFormat('Y-m-d H:i:s', '2018-10-03 13:20:52')->toDateTimeString())
->orWhere('valid_to', '>=', Carbon::createFromFormat('Y-m-d H:i:s', '2018-10-03 13:20:52')->toDateTimeString())
->orWhere('channel', 'en-us')
->orWhere('language', 'en')
->orWhere('valid_to', null)
->orWhere('channel', null)
->orWhere('language', null)
->get();
The above script will give you the same data as you want.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community