WEB DEVELOPER SITE
TUTORIALS HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Laravel - Forms


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

Example 1

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

composer require enlighten/html 

Step 2 − This will add HTML bundle to Laravel as appeared in the accompanying image.

HTML Package

Step 3 − Now, we have to add the bundle appeared at Laravel arrangement 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 accompanying picture. Include HTML specialist co-op as demonstrated in the laid out box in the accompanying image.

Laravel Service

Step 4 − Add monikers in a similar document for HTML and Form. Notice the two lines demonstrated in the sketched out box in the accompanying 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 accompanying code to make a view called

resources/sees/form.php.

resources/sees/form.php

<html> 

<body> 

<?php 

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(); 

?> 

</body> 

</html>

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

app/Http/routes.php

Route::get('/form',function(){ 

return view('form'); 

}); 

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

http://localhost:8000/structure 

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

View Form