HTML Helper for Laravel Framework
composer require vaneves/laravel-form
Add the Form
facade to the aliases
array in config/app.php
:, (*1)
'aliases' => [ //... 'Form' => Vaneves\Laravel\Form\Form::class, ]
{!! Form::open('register') !!} {!! Form::text('Your name', 'name') !!} {!! Form::email('Email', 'email') !!} {!! Form::password('Password', 'password') !!} {!! Form::reset('Clear')->warning() !!} {!! Form::submit('Save')->primary() !!} {!! Form::close() !!}
Add attribute required
in field., (*2)
Remove attribute required
from field., (*3)
Add class input-lg
in field., (*4)
Add class input-sm
in field., (*5)
Add an attribute with data
in element. Example:, (*6)
{!! Form::text('Your Name', 'name')->attr('my-prop', 'value') !!}
Output:, (*7)
<div class="form-group"> <label for="name">Your Name</label> <input type="text" class="form-control" id="name" my-prop="value"> </div>
Remove an attribute from element., (*8)
Add an attribute with data
in element. Example:, (*9)
{!! Form::text('Your Name', 'name')->data('my-prop', 'value') !!}
Output:, (*10)
<div class="form-group"> <label for="name">Your Name</label> <input type="text" class="form-control" id="name" data-my-prop="value"> </div>
Add an class in element. Example:, (*11)
{!! Form::text('Your Name', 'name')->addClass('material-design') !!}
Output:, (*12)
<div class="form-group"> <label for="name">Your Name</label> <input type="text" class="form-control material-design" id="name"> </div>
Remove class from element., (*13)