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
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire