问题
Appointment::whereDate('schedule_date', '=', date('Y-m-d'))
->whereTime('time_from', ' <= ', date('H:i:s'))
->whereTime('time_to', ' <= ', date('H:i:s', strtotime('+1 hour')))
->get();
When this code is running on the production server, there's no response. Perhaps it's for quotation? But how can I add this? I mean quotation (single/double).
回答1:
This appears to be a possible bug in laravel not enclosing the date in quotes, this results in it treating the Y-m-d as a maths operation.
whereDate('schedule_date', '=', date('Y-m-d'))
becomes
schedule_date = 2019-09-10
becomes
schedule_date = 2006
来源:https://stackoverflow.com/questions/54846061/laravel-5-5-wheredate-wheretime-not-add-quotation