What is Form class not Found in Laravel?

laravelcollective/html is provide very easy way to use html textbox, select box, radio button, checkbox etc with laravel. They provide several method to use those input fields.

Solution for Laravel 6

composer require laravelcollective/html

Solution for Laravel 5.6

File name : index.php

composer require "laravelcollective/html":"^5.8"

composer require "laravelcollective/html":"^6"

In app.php file


'providers' => [

Collective\Html\HtmlServiceProvider::class,

],
'aliases' => [

'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,

],

How to use Form open in laravel

File name : index.php

{!! Form::open( [ 'action' => url( '/login_validate' ), 'method' => 'post', 'files' => true ] ) !!}
// Your form body
{!! Form::close() !!}

How to use Form open in laravel

File name : index.php

{{ Form::open(array('url' => 'add_category','files' => true, 'method'=>'post')) }}
// Your form body
{!! Form::close() !!}

Note : bydefault method="post" in form open

How to use Form open in laravel

File name : index.php

{!! Form::open(['url'=>'add_category', 'files' => true]) !!}


{!! Form::close() !!}

How to use Form open in laravel

You may also open forms that point to named routes or controller actions:

File name : index.php

echo Form::open(array('route' => 'route.name'))

echo Form::open(array('action' => 'Controller@method'))


You may pass in route parameters

echo Form::open(array('route' => array('route.name', $user->id)))

echo Form::open(array('action' => array('Controller@method', $user->id)))

Another Way :-

{{ Form::open(array('route' => array('user.show', $user->id))) }}
with class name

{{ Form::open(array('route' => array('user.show', $user->id), 'class' => 'section-top')) }}



Previous Next


Trending Tutorials




Review & Rating

0.0 / 5

0 Review

5
(0)

4
(0)

3
(0)

2
(0)

1
(0)

Write Review Here

Ittutorial