Tutorial: create a new form in Laravel 4.2

Hi guys! In this tutorial I will speak again about Laravel. In this tutorial I will explain how you can create forms in Laravel.

If you want to create a new form, open the view file and add this code:

{{ Form::open(array('url' => 'foo/bar')) }}

{{ Form::close() }}

It will display

<form method="POST" action="" accept-charset="UTF-8">


Open the php tags and if you want to create a label element, add

echo Form::label('label', 'Text label');

If you want to create a text input fiekd, add

echo Form::text('username');

You can create a password field by adding

echo Form::password('password');

If you want to add a checkbox or radio input, add

echo Form::checkbox('name', 'value');

echo Form::radio('name', 'value');

And, if you want to add file input, use

echo Form::file('image');

Video tutorial:

Leave a Comment