3

I'm a novice in Laravel development. I'm learning about Form. But I'm not understanding why i need to learn again about Form for Laravel as i know how to use form in pure html. I'm confused about that should i use laravel's collective form or Pure Html Form? Which is better?

smk pobon
  • 83
  • 1
  • 10

1 Answers1

6

I find collective to be more useful in two ways.

1) Using Laravel collective gives CSRF protection automatically by including hidden field with a security token as a form element which traditional html form does not and you have do that manually by using {{ csrf_field() }}. Not including is erroneous.

2) When updating the database info, Form::model() to bind the data to form fields and makes it way easier to populate the form fields with the data to be edited like auto checking checkboxes etc. which saves quite a overhead.

Arshiva
  • 426
  • 1
  • 4
  • 14
  • I agree. The "old" input handling when there are validation errors is reason alone to use the form helpers. – ceejayoz May 01 '17 at 13:23
  • but it's harder to learn than `pure html`. Also i can't customize it(`laravel collective html`) as pure html. what about that ? Also the `{{csrf_field()}}` can be included in a form very easily in pure html too by that command, so why will i use `collective`? @ceejayoz @notme – smk pobon May 05 '17 at 14:14
  • @smkpobon It's up to you. You asked for opinions, and got opinions. – ceejayoz May 05 '17 at 14:25