jeudi 28 janvier 2016

Laravel Where Between Dates

I have a table which gathers simple datetime in and datetime out for a user.

I'm using laravel to output the rows where indate_time is between specific date range.

From Date: 2016/01/28
To Date: 2016/01/28

Sample entry in my table

ID | indate_time          | outdate_time
1  | 2016-01-28 21:22:49  | 2016-01-28 21:46:05

At the moment Im getting no response here's my laravel query

$from = '2016/01/28';
$to = '2016/01/28';
$id = 1;

        $attendance = DB::table('attendances')
        ->whereBetween('indate_time', array($from, $to))->where('id', $id)->orderBy('indate_time', 'desc')
        ->get();



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1QvWqr6
via IFTTT

Aucun commentaire:

Enregistrer un commentaire