File tree Expand file tree Collapse file tree 1 file changed +10
-16
lines changed
Expand file tree Collapse file tree 1 file changed +10
-16
lines changed Original file line number Diff line number Diff line change @@ -40,24 +40,18 @@ public function register()
4040 */
4141 public function boot ()
4242 {
43- /*
44- * Register View composer
43+ /**
44+ * Register Blade Directive
4545 *
46- * Share global view variable `$route_body_classes`, which represents the final body class
47- * string after all generators have run.
46+ * Using @route2class_generate_classes will output the class string generated by
47+ * \Route2Class::generateClassString()
48+ *
49+ * If you want to ensure your classes are never cached from Blade (ie: testing), instead use the facade to
50+ * print your classes:
51+ * `\Route2Class::generateClassString()`
4852 */
49- View::composer ('* ' , function (\Illuminate \View \View $ view ) {
50-
51- // Let app handle 404s
52- if (!request ()->route ()) {
53- return ;
54- }
55-
56- $ view ->with ('generate_route_body_classes ' , function () {
57- $ routeToClass = app ()['route2class ' ];
58-
59- return $ routeToClass ->generateClassString ();
60- });
53+ \Blade::directive ('route2class_generate_classes ' , function () {
54+ return \Route2Class::generateClassString ();
6155 });
6256 }
6357}
You can’t perform that action at this time.
0 commit comments