Laravel - Forms

Laravel - Forms : Laravel gives different in elements labels to add with HTML shapes effectively and safely.

Example 1

Step 1 − Execute the command order to continue with the same.

composer require illuminate/html 

Step 2 − This will add HTML package to Laravel as appeared in the command image.

HTML Package

Step 3 − Now, we have to add the package appeared at Laravel configuration document which is put away at config/app.php. Open this record and you will see a rundown of Laravel specialist organizations as appeared in the command picture. Include HTML specialist co-op as indicated in the laid out box in the command image.

Laravel Service

Step 4 − Add aliases in a similar document for HTML and Form. Notice the two lines indicated in the sketched out box in the command picture and include those two lines.

Outlined Box

Step 5 − Now everything is setup. We should perceive how we can utilize different HTML components utilizing Laravel tags.

Opening a Form

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


{{ Form::close() }} 

Generating a Label Element

echo Form::label('email', 'Email Address'); 

Generating a Text Input

echo Form::text('username'); 

Specifying a Default Value

echo Form::text('email', 'example@gmail.com'); 

Generating a Password Input

echo Form::password('password'); 

Generating a File Input

echo Form::file('image'); 

Generating a Checkbox Or Radio Input

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

reverberation Form::radio('name', 'esteem'); 

Generating a Checkbox Or Radio Input That Is Checked

echo Form::checkbox('name', 'esteem', genuine); 

reverberation Form::radio('name', 'esteem', genuine); 

Generating a Drop-Down List

echo Form::select('size', array('L' => 'Extensive', 'S' => 'Small')); 

Generating A Submit Button

echo Form::submit('Click Me!'); 

Example 2

Step 1 − Copy the command code to make a view called






reverberation Form::open(array('url' => 'foo/bar')); 

reverberation Form::text('username','Username'); 

reverberation '<br/>'; 

reverberation Form::text('email', 'example@gmail.com'); 

reverberation '<br/>'; 

reverberation Form::password('password'); 

reverberation '<br/>'; 

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

reverberation '<br/>'; 

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

reverberation '<br/>'; 

reverberation Form::file('image'); 

reverberation '<br/>'; 

reverberation Form::select('size', array('L' => 'Large', 'S' => 'Small')); 

reverberation '<br/>'; 

reverberation Form::submit('Click Me!'); 

reverberation Form::close(); 




Step 2 − Add the command line in app/Http/routes.php to include a course for view form.php



return view('form'); 


Step 3 − Visit the command URL to see the form.


Step 4 − The yield will show up as appeared in the command image.

View Form