-
Convert SQL Query into Laravel?
over 7 years ago
-
over 7 years ago
Hi,
You can use this query in laravel with following methods,
DB::table('jobs')
->where('published', '1')
->where(function($query){
$query->orWhereBetween('created_at', ['2017-05-12 00:00:00', '2017-05-13 00:00:00']);
$query->orWhereBetween('created_at', ['2017-05-10 00:00:00', '2017-05-12 00:00:00']);
$query->orWhereBetween('created_at', ['2017-05-05 00:00:00', '2017-05-12 00:00:00']);
$query->orWhereBetween('created_at', ['2017-04-12 00:00:00', '2017-05-12 00:00:00']);
})
->orderBy('id', 'DESC')
->get();
Let us know if you have any query or doubt.
Thanks -
1 Answer(s)