jeudi 31 décembre 2015

date format in laravel 5

how to get records between current date to next 30 days in laravel 5? Here is the code i used for that.

public static function getNextInspections() 
{
$inspection = DB::table('inspection');
$inspection->select('*');
$inspection ->where('inspection.next_inspection_date', DB::raw('BETWEEN NOW() AND DATE_ADD(NOW(),INTERVAL 30 DAY)'));
return $inspection->get();

}

I don't get proper answer in laravel 5. but I got the answer in mysql. Given below is the MySQL command i used:

"select equipment_id, next_inspection_date,deleted_at from inspection where next_inspection_date BETWEEN NOW() AND DATE_ADD(now(), INTERVAL 30 DAY);"

Can anyone help me with?



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

Aucun commentaire:

Enregistrer un commentaire