Skip to content

Commit b40471d

Browse files
committed
formatting + docs
1 parent 61cc3b1 commit b40471d

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

src/ServiceProvider.php

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,23 @@
22

33
namespace Zschuessler\RouteToClass;
44

5-
65
use Illuminate\Support\Facades\View;
76

87
class 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

0 commit comments

Comments
 (0)