File tree Expand file tree Collapse file tree 1 file changed +8
-14
lines changed Expand file tree Collapse file tree 1 file changed +8
-14
lines changed Original file line number Diff line number Diff line change 22
33namespace Zschuessler \RouteToClass ;
44
5-
65use Illuminate \Support \Facades \View ;
76
87class ServiceProvider extends \Illuminate \Support \ServiceProvider
98{
109 /**
11- * Register bindings in the container.
12- *
1310 * @return void
1411 */
1512 public function boot ()
1613 {
14+ /**
15+ * Register View composer
16+ *
17+ * Share global view variable `$route_body_classes`, which is a unique body class
18+ * inflected based on the route path.
19+ *
20+ * example: `/admin/products/25/edit` becomes `admin-products-edit`
21+ */
1722 View::composer ('* ' , function (\Illuminate \View \View $ view ) {
1823 $ route = request ()->route ()->getPath ();
1924
@@ -30,18 +35,7 @@ public function boot()
3035 $ clean = preg_replace ("/[\/_|+ -]+/ " , '- ' , $ clean );
3136
3237 View::share ('route_body_classes ' , $ clean );
33-
3438 });
3539 }
36-
37- /**
38- * Register the service provider.
39- *
40- * @return void
41- */
42- public function register ()
43- {
44- //
45- }
4640}
4741
You can’t perform that action at this time.
0 commit comments