1

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

Pᴇʜ
  • 56,719
  • 10
  • 49
  • 73
Danishdjinn
  • 607
  • 1
  • 6
  • 11

2 Answers2

10

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.

Danishdjinn
  • 607
  • 1
  • 6
  • 11
2

You can get full solution about form builder in Laravel 5.2.

Run command prompt and execute

  1. composer require laravelcollective/html
  2. Open config/app.php In providers array add Collective\Html\HtmlServiceProvider::class and in aliases 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

Qazi
  • 5,015
  • 8
  • 42
  • 62
masuduzzaman
  • 113
  • 1
  • 5