vendredi 30 août 2019

How can I register a View::composer from a Laravel package?

How can I register a View::composer for use in a Laravel project from within a Laravel package?

In my package service provider I have a boot method with routes/views etc and this in the register function:

public function register()
    {

        $this->app->register(ComposerServiceProvider::class); 
    }

In the ComposerServiceProvider I have:

   public function boot()
    {
        View::composer(
            'admin.*', ProfileComposer::class
        );
    }

Which should load the ProfileComposer class into all admin.* views, but it's not working. I can't see anything in the Laravel documentation regarding loading View Composers from packages

This code has been extracted from my working laravel project for use as a package going forward but the view composers are causing issues



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2UgF35H
via IFTTT

Aucun commentaire:

Enregistrer un commentaire