Form
isn't included in laravel
5.0 as it was on 4.0, steps to include it:
Begin by installing laravelcollective/html
package through Composer
. Edit your project's composer.json
file to require:
"require": {
"laravelcollective/html": "~5.0"
}
Next, update composer
from the Terminal:
composer update
Next, add your new provider to the providers
array of config/app.php
:
'providers' => [
// ...
'CollectiveHtmlHtmlServiceProvider',
// ...
],
Finally, add two class aliases to the aliases
array of config/app.php
:
'aliases' => [
// ...
'Form' => 'CollectiveHtmlFormFacade',
'Html' => 'CollectiveHtmlHtmlFacade',
// ...
],
At this point, Form
should be working
Source
Update Laravel 5.8
(2019-04-05):
In Laravel 5.8
, the providers
in the config/app.php
can be declared as:
CollectiveHtmlHtmlServiceProvider::class,
instead of:
'CollectiveHtmlHtmlServiceProvider',
This notation is the same for the aliases.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…