How to add an attribute of type HTML 5 to a laravel blade?

I have this line in blade format

{{ Form::text('date', null, array('class' => 'form-control', 'type' => 'Date', 'placeholder' => 'Date' )) }} 

but when the page loads, the type attribute does not get permission to 'date', it goes to 'text'.

How do I get this in the blade?

 <input class="form-control" type="date" placeholder="Date" name="date"> 
+6
source share
4 answers

Use Form :: input ()

 Form::input('date', 'date', null, ['class' => 'form-control', 'placeholder' => 'Date']); 

In addition, you can create Macro forms to add methods for HTML5 attributes such as date , email , time , etc.

+18
source

I'm not sure, but try changing Form::text to Form::date ?

+1
source

With Laravel 5.1, I use this for a date field.

 {!! Form::date('start_date', null, ['class' => 'form-control col-md-7 col-xs-12', 'placeholder' => 'Date']); !!} 
+1
source

There are also several composer / package packages that you can quickly install to use HTML5 elements just like text , email and url (for example: Form::date('myDateField') )

Here's one: https://github.com/smalldogs/html5inputs

0
source

All Articles