View::composer(
['profile', 'dashboard'],
'App\Http\ViewComposers\MyViewComposer'
);
View::composer('*', function ($view) {
//
});
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.