mySun
mySun

Reputation: 1696

Class 'Form' not found in Laravel 5.3?

In Laravel 5.2 form class in app.php is:

'aliases' => [
 // ...
  'Form' => Collective\Html\FormFacade::class,
  'Html' => Collective\Html\HtmlFacade::class,
 // ...
],

But this code not work in Laravel 5.3.

How to add class Form in Laravel 5.3 ?

Upvotes: 1

Views: 2378

Answers (2)

Parvez Ahmed
Parvez Ahmed

Reputation: 650

1st step install this via composer

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

Laravel Collective here

2nd step add this line in config/app.php under providers

    'providers' => [
    // ...
    Collective\Html\HtmlServiceProvider::class,
    // ...
  ],

3rd step

add this 2 line in config/app.php under aliases array

    'aliases' => [
    // ...
      'Form' => Collective\Html\FormFacade::class,
      'Html' => Collective\Html\HtmlFacade::class,
    // ...
  ],

final step then link your html and css this way

{{ Html::style('css/demo.css') }}
{{ Html::script('js/demo.js') }}

Upvotes: 1

aimme
aimme

Reputation: 6763

Its called the Laravel Collective package and It has been removed from laravel defaults.

You can still integrate and use it.

here is the documentation Laravel Collective

How to Install

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

Next, add your new provider to the providers array of config/app.php:

  'providers' => [
    // ...
    Collective\Html\HtmlServiceProvider::class,
    // ...
  ],

Finally, add two class aliases to the aliases array of config/app.php:

  'aliases' => [
    // ...
      'Form' => Collective\Html\FormFacade::class,
      'Html' => Collective\Html\HtmlFacade::class,
    // ...
  ],

Upvotes: 4

Related Questions