samedi 21 mai 2016

unable to use DateTime in laravel

I am using DateTime in controller as:

public function index()
  {
    $seats=seats::all();
    $date = date('Y-M-D');
    $tomorrow= new \DateTime('tomorrow');
        $nextday= new \DateTime('tomorrow + 1day');
        return view('bus.busview',['mytime'=>$date,'seats'=>$seats,'nextday'=>

$nextday,'tomorrow'=>$tomorrow]);

}

but while using these variables in view:

Your Name: <input type="name" name="name" id="name" ><br><BR>
Your Contact No. <input type="contact" name="contact" id="contact" ><br><BR>
Todays date:<mark></mark><br><br>
tomorrows date:
Book for: <select>
  <option name="select" value="">Today</option>
  <option name="select" value="">Tomorrow</option>
  <option name="select" value=""></option>
  <option name="select" value=""></option>
</select>

i am getting this error:

htmlentities() expects parameter 1 to be string, object given



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

Aucun commentaire:

Enregistrer un commentaire