caffeinated / menus

:pushpin: Menu generator package for the Laravel framework
https://caffeinatedpackages.com
132 stars 59 forks source link

Class html does not exist #4

Closed piperone closed 9 years ago

piperone commented 9 years ago

I have no idea if I've done this correctly. Basically, I did as you suggested: Made a new service provider called MenuServiceProvider with two methods - one empty register-method and a boot-method that has the code from the example in your readme (\Menu::make(...)). I then registered it in config/app.php.

Now I just get this:

ReflectionException in Container.php line 776:
Class html does not exist
ParadoxNL commented 9 years ago

By default in Laravel 5.0, Html and Form are not embedded anymore.

Add the following lines in the require section of composer.json file and run composer update "illuminate/html": "5.*"

Register the service provider in config/app.php by adding the following value into the providers array: 'Illuminate\Html\HtmlServiceProvider'

Register facades by adding these two lines in the aliases array: 'Form'=> 'Illuminate\Html\FormFacade', 'HTML'=> 'Illuminate\Html\HtmlFacade'

Source: http://laravel.io/forum/09-20-2014-html-form-class-not-found-in-laravel-5

ParadoxNL commented 9 years ago

Coming back on my original answer, after finding out that they use Collective\Html\HtmlServiceProvider. I managed to solve your error by loading this manually in the service providers.

kaidesu commented 9 years ago

This is an error on my part though, I believe I'm using the HTML facade directly in the package rather than injecting it where I need it (I'll try to look into it today).

You shouldn't be forced to install a separate package and edit your service providers in this manner.

piperone commented 9 years ago

Yea, I saw that the Laravel-Collective-stuff was installed, so I assumed I didn't have to go through the require-illuminate-html-drill. It's a minor issue though, so I'm guessing @kaidesu will have it fixed before long :)

ParadoxNL commented 9 years ago

Just register it in the package boot fuction like this:

public function boot() {
    $this->app->register('Collective\Html\HtmlServiceProvider');
}

And it should work flawlessly.

kaidesu commented 9 years ago

@ParadoxNL thanks~

I pushed an update for this: 2820fb848da1c1a8e5aa7f399e52197bff4b67cf per ParadoxNL's suggestion (after checking, I was not referencing any facade directly). Let me know if this fixes your issue and we can get this closed :smile: