It's supposed to be blank. How can I prevent this from happening? I am using this code to show the date
public function bookedOn($chalet_id) {
$chalet = \App\Chalet::where('chalet_id', '=', $chalet_id)->get();
if ($chalet->count() > 0) {
$books = \App\EventBookings::where('chalet_id', '=', $chalet[0]->chalet_id)->value('created_at');
$str = date('M. d, Y',strtotime($books));
return $str;
} else {
return false;
}
}
I think there is something I need to do here:
$str = date('M. d, Y',strtotime($books));