php - How to take time as an input in Laravel? -


i want take input time am/pm using laravel controller mysql. problem have taken time blade view while seeing output using dd() it's showing following value.

carbon {#213 ▼   +"date": "2016-05-09 00:00:00.000000"   +"timezone_type": 3   +"timezone": "utc" } 

means nothing save start value.

here model:

class room extends model {      protected $table='allocate_rooms';              } 

here view i've used:

<div class="form-group">       <label>from</label>       <input type="time" name="start" class="form-control" required > </div> 

here controller i'm using.

public function allocateroom(request $request)     {             $room = new room();               $room->start =carbon::parse($request->input('start'));             dd($room->start);             $room->save();      } 

in database have used time datatype start

in model need date mutator:

class room extends model {      protected $table='allocate_rooms';                   protected $dates = ['start']; } 

more information:

https://laravel.com/docs/5.1/eloquent-mutators#date-mutators


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -