In my blade I have this line of code:
{!! Form::file('motivation', old('motivation'), ['id' => 'inputGroupMotivation', 'class' => 'custom-file-input']) !!}
As you can see i set an id by doing 'id' => 'inputGroupMotivation'
. However when I go to the page where this blade is rendered it outputs this:
<input name="motivation" type="file">
How come it does not take the id and class attributes I've set in my code?
I have not personally used the Form
facade in Laravel, however from briefly looking at the documentation, it seems that the syntax for the file
method is a bit different from regular input methods such as text
. Namely, the second parameter is not the old value, but the list of attributes you would want to pass.
In your case you would this code instead:
{!! Form::file('motivation', ['id' => 'inputGroupMotivation', 'class' => 'custom-file-input']) !!}
For more information, take a look at the LaravelCollective's documentation page.