Laravel Form for Beginner

Laravel Form for Beginner

Sharing is caring!

Laravel Form For Beginner

One of the very basic requirements of all online applications is that the user should be able to enter data. Web forms are the most commonly used methods for entering data into an application and so they are a fundamental thing that you need to get right.

Laravel is a framework that aims to make developing and maintaining web applications as easy as possible. One of the ways this is achieved is by having an excellent Form class that makes creating and interacting with forms extremely easy.

A lot of other frameworks seem to make working with forms much harder then they need to be. In my experience they are either too rigid or not comprehensive enough! If you are coming at this from a non-framework perspective, using a form builder might seem a little bit strange, but hopefully by the end of this tutorial you will be able to see the benefits.

Laravel produces HTML forms easily within seconds with blade template engine.

Use the Form::open() method to create a form in laravel.In laravel blade template this can done by many ways

HTML produces for above one is


This starts a form using a post method to the current URL and will add an

accept-charset=”UTF-8″ to the form.additionally,a hidden token is added.

To Specific URL:Instead of passing an action you should pass an url.

HTML for the above code is

To a route: Instead of passing an action you should pass an route value to one of the named route.

if route doesnt exist an error will be occured.Else form’s action attribute will becomes full URL to the route.

To a Controller action

if there is no controller of that name error will be provided.Html for the above code:

Specifying different methods:

HTML for above code is:

As you can see there is no token for get methods.

Specify File Upload:

HTML for above code:

https://www.youtube.com/watch?v=Hzm9L3yVCt0&list=PL3ZhWMazGi9IcgWunA4izwTkd9QjSGW2j

Sharing is caring!

Comments are closed.