Looks like wildcards in Laravel’s works. At the moment, they are simply undocumented.
View::composer('admin.layouts.*', function($view) { if (Sentry::check()) $view->with('navigation', View::make('admin._partials.navigation')); else $view->with('navigation', null); });
That's what I was looking for.
Update: Here is an alternative solution.
You can also snap it to a layout, so that all sub-points that expand this layout will benefit from the composer.
View::composer('admin.layouts.main_layout', function($view) { if (Sentry::check()) $view->with('navigation', View::make('admin._partials.navigation')); else $view->with('navigation', null); });
It will associate composers with every view that @extend('admin.layouts.main_layout') does.
Aristona
source share