Search code examples
phpcomposer-phpphpstormlaravel-5laravelcollective

Laravel 5.2: Undefined class form


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


Solution

  • 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.