andrechalom
2 years ago
101
5
Laravel

Having trouble to set up auto-discovery for a Facade

Posted 2 years ago by andrechalom

Hi! I'm developing a small package for Laravel, and it's working fine under Laravel 5.4. I'm trying to provide the composer rules for the new auto-discovery on Laravel 5.5, but it is failing to find the required class. I wasn't able to find any in-depth documentation of the auto-discovery, but from the changes in Laravel Debugbar and from the Laracast's Video it seems that the syntax is pretty straightforward:

   "extra": {
        "branch-alias": {
            "dev-master": "1.0-dev"
        },
        "laravel": {
            "providers": [
                "AndreChalom\\LaravelMultiselect\\MultiselectServiceProvider"
            ],
            "aliases": {
                "Multiselect": "AndreChalom\\LaravelMultiselect\\MultiselectFacade"
            }
        }
    },  

The MultiselectFacade and MultiselectServiceProvider are working fine when explicitly included in the config/app.php file, and I can use the {!! Multiselect::select(...) !!} just fine in my blade templates. I can also comment out the "MultiselectServiceProvider" line and everything works fine - the provider is auto-discovered and registers the Multiselect service. Yay!

However, if I delete the "MultiselectFacade" line from the config/app.php, relying on the auto-discovery, suddenly the application fails with "Class 'Multiselect' not found". What I may be missing? How can I debug this?

Please sign in or create an account to participate in this conversation.