There are so many advantages of using Laravel
's Form
component but one useful advantage is that, when you just use this:
{{ Form::open(array('url' => 'foo/bar')) }}
{{ Form::close() }}
It automatically appends a hidden _token
field which is useful for CSRF
protection. otherwise you have to manually create the _token
field using echo Form::token()
or other way maybe. Also, when you use RESTful
routes then Laravel
's Form
component appends the corresponding hidden _method
field as well. Following note is taken from Laravel
website:
Note: Since HTML forms only support POST and GET, PUT and DELETE
methods will be spoofed by automatically adding a _method hidden field
to your form.
There are also other advantages like Form Model Binding
, generating form elements (specially select
) easily and many more. Read more about Form
on documentation.
BTW, the Redirect::back()->withInput()
doesn't deppend only on use of Form
component, if you use something like this, for example:
<input type='text' name='username' value='<?php echo Input::old('username') ?>' />
This will still work, the field will be repopulated on redirect back with inputs.