File tree 1 file changed +8
-14
lines changed
1 file changed +8
-14
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace Zschuessler \RouteToClass ;
4
4
5
-
6
5
use Illuminate \Support \Facades \View ;
7
6
8
7
class ServiceProvider extends \Illuminate \Support \ServiceProvider
9
8
{
10
9
/**
11
- * Register bindings in the container.
12
- *
13
10
* @return void
14
11
*/
15
12
public function boot ()
16
13
{
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
+ */
17
22
View::composer ('* ' , function (\Illuminate \View \View $ view ) {
18
23
$ route = request ()->route ()->getPath ();
19
24
@@ -30,18 +35,7 @@ public function boot()
30
35
$ clean = preg_replace ("/[\/_|+ -]+/ " , '- ' , $ clean );
31
36
32
37
View::share ('route_body_classes ' , $ clean );
33
-
34
38
});
35
39
}
36
-
37
- /**
38
- * Register the service provider.
39
- *
40
- * @return void
41
- */
42
- public function register ()
43
- {
44
- //
45
- }
46
40
}
47
41
You can’t perform that action at this time.
0 commit comments