File tree 1 file changed +10
-16
lines changed 1 file changed +10
-16
lines changed Original file line number Diff line number Diff line change @@ -40,24 +40,18 @@ public function register()
40
40
*/
41
41
public function boot ()
42
42
{
43
- /*
44
- * Register View composer
43
+ /**
44
+ * Register Blade Directive
45
45
*
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()`
48
52
*/
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 ();
61
55
});
62
56
}
63
57
}
You can’t perform that action at this time.
0 commit comments