Laravel - Views - Attaching A Composer To Multiple Views

You may attach a view composer to multiple views at once by passing an array of views as the first argument to the composer method:

    
    use App\Views\Composers\MultiComposer;
    
    View::composer(
        ['profile', 'dashboard'],
        MultiComposer::class
    );
	

The composer method also accepts the * character as a wildcard, allowing you to attach a composer to all views:

    
    View::composer('*', function ($view) {
        //
    });