let's try this
DB::table('table')
->select('column1', 'column2', 'column3')
->get();
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;
@Pardeeptech this olution not for my case @abinadi result is null
Iwan to shot this result my query to implemented on Laravel.
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..
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community