Aug 5, 2016
0
Level 2
How to add one day to the date retrieved using DB facade?
I want to add one day to my end date, which I retrieve as end. I have tried
$holiday->end = $holiday-end->modify('+1 day');
Doesn't work.
Here is the code I'm trying to modify.
Route::get('/holidayapi', function () {
$holidays = DB::table('holiday_requests')->select('id', 'name','startdate as start', 'enddate as end', 'status')->get();
foreach($holidays as $holiday)
{
$holiday->title = $holiday->name . ' - ' .$holiday->status;
$holiday->url = url('holidays/' . $holiday->id);
}
return $holidays;
});
Please or to participate in this conversation.