Laravel 5 version got us confused by separating our beloved Form::open world into a separate package. Now you have to add “illuminate/html”: “~5.0” to your projects, whenever you want to use forms, right? Not necessary, you can survive without it.
How we would build a simple form with that package:
{!! Form::open(array('url' => 'admin/cities')) !!} City name:
{!! Form::text('title', old('title')) !!}
{!! Form::submit('Save') !!} {!! Form::close() !!}
Now, how it looks if we build it in plain Laravel/HTML:
It’s not that bad, is it? The only thing we need to take differently is take care of CSRF protection, which is basically done with method csrf_field().
Another example would be a DELETE form – here we need to use two additional methods.
As you can see, function method_field() is used for adding a hidden field like this:
Then Laravel mechanism would point that form to the correct Controller method delete().
So, the question remains open: do we really need that external illuminate/html Form functionality? Not always. Probably, depends on your skills – which would give you faster results – and on your particular usage in your application.
Which one do you prefer? Do yo use that package? Tell your experience in comments.
Form-model binding is a killer-feature for me so I use these everyday with the [Laravel Collective HTML & Forms package](http://laravelcollective.com/docs/5.1/html). I even made a package a snippets to use them with [Sublime Text](https://github.com/redgluten/laravel_forms_boostrap_snippets) and [Atom](https://github.com/redgluten/laravel-form-bootstrap-snippets-atom).
Great to hear, Gluten, thanks for the comment. Yes, correct, form-model binding is quite a valid reason to use the package.
I use Form::model, too. How would one accomplish an edit form with out the package? Also, I use Form::label, which can obviously be replaced with straight HTML. Finally, why aren’t you escaping old(‘title’)? You have {!! not {{
Hi Philip, agree on the Form::model, whereas Form::label is, as you say, easily replaceable. And thanks for the notice, my mistake, changed the escaping in the text.
I have a package that integrates the Laravel with the form of twitter bootstrap. https://github.com/rdehnhardt/html
For people who come from L4, i’m prefer to use Illuminate Form Facade / Html Facade 🙂
Sir, I have a question about mail sending.
How can I send mail to localhost/xampp to gmail?
should I change php.ini from xampp or not?
if I should not, then what i have to do for sending mail?
please , tell me elaborately
From L4. I am very shocked by this change. It is absurd!! EVERYONE uses HTML::style and HTML::link. Furthermore, EVERYONE uses HTML::Form unless you are making a kindergarten web page.
Thank you for this, have been looking all over for this information. We have not installed the Form package and it’s hard to find examples without it.