lundi 7 novembre 2016

Subtract seconds in field from date query building Laravel 5

I have a backend in Laravel 5.1 where I have 2 coloumns in my table:
seconds and date.
I have to implement function that select records where date is beetween from Carbon::now() and Carbon::now()->addMinute(60)-seconds where seconds is a field registered on my db. So select record if now is 07/11/2016 11:00 and in my table I have date 07/11/2016 10:50 and in my record second have 600.

so far I have done a this query:

DB::table('table')->whereBetween('table.date', array(Carbon::now() , Carbon::now()->addMinute(60)))

But how can I subtract second from a field table?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire