问题
I have a problem with using Form command in a Composer + Laravel 5.2 project with PhpStorm as IDE.
I'm using Laravel Collective 5.2. in my composer.json
, so it should work. (sadly, it's not which is the reason I'm here...)
The providers:
Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,
Collective\Html\HtmlServiceProvider::class,
my aliases.
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
The problem: It's returned as a undefined class when I'm using {!! Form::close() !!}
or any form command in my blade.php
.
Did I misunderstood something when I installed it in the project? What do I need to configure in order for this to work?
And yes, I have looking around on forums. The answers didn't help because they were for Laravel 4 or Laravel 5.1. :S
回答1:
Actually i'm not even mad that's amazing because I found a solution to my problem... just around 5 min after I post my question... And I spend around 2 hours to find a solution...
All I did was:
php artisan clear-compiled
php artisan ide-helper:generate
php artisan optimize
and reload the blade.php
.
I have no idea why, but it works now. It seems I forgot to run the above commands after I got Laravel Collective 5.2 in the project. This could be the reason that form command didn't work. .___.;;
I hope someone could use this information for their own project.
回答2:
You can get full solution about form builder in Laravel 5.2.
Run command prompt and execute
- composer require laravelcollective/html
- Open
config/app.php
Inproviders
array addCollective\Html\HtmlServiceProvider::class
and inaliases
array add
‘Form’ => Collective\Html\FormFacade::class, ‘Html’ => Collective\Html\HtmlFacade::class
For more details, See there http://laraveldeveloper.me/form-in-laravel-5-2
来源:https://stackoverflow.com/questions/34806513/laravel-5-2-undefined-class-form