Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 3 weeks ago.
0

let's try this

DB::table('table')
    ->select('column1', 'column2', 'column3')
    ->get();
0

You are using whereBetween incorrectly. The first parameter should be the column name.

It would be better to just use two "where" clauses. You should put:

$waktu = explode(" ", $datetime);
$rs = DB::table('otc_shift')
    ->select('shift_id')
    ->whereNull('deleted_at')
    ->where('shift_time_start','<',$waktu[1])
    ->where('shift_time_end','>',$waktu[1])
    ->first();
return $rs->shift_id;
Last updated 3 years ago.
0

@Pardeeptech this olution not for my case @abinadi result is null

Iwan to shot this result my query to implemented on Laravel. I want implemented manual query to Laravel like this

0

Try

->whereRaw("'10:00:00' BETWEEN shift_time_start AND shift_time_end")
Last updated 3 years ago.
0

Perfecto.. @tezlopchan with this code:

->whereRaw("'$waktu[1]' BETWEEN shift_time_start AND shift_time_end")

But if i have $waktu[1] = '23:00:00' result is null..

0

->whereRaw("'?' BETWEEN shift_time_start AND shift_time_end", [$datetime->format('H:i:s')])

0

Sign in to participate in this thread!

LaraJobs

Your banner here too?

Kang Mul Kang Mul omysurya Joined 24 Aug 2018

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.