File tree 2 files changed +48
-0
lines changed 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change 1
1
/vendor /
2
+ .idea
Original file line number Diff line number Diff line change
1
+ # Laravel Routes to Body Class
2
+
3
+ Quickly add a unique body class to your view based on your Laravel routes.
4
+
5
+ ## Example
6
+
7
+ You have a route defined for editing your products:
8
+
9
+ ``` php
10
+ Route::get(
11
+ '/admin/products/{product_id}/edit',
12
+ 'ProductAdminController@getEdit'
13
+ )
14
+ ```
15
+
16
+ This library will add the class ` admin-products-edit ` as a shared view variable automatically.
17
+
18
+ ## Install
19
+
20
+ ### 1 - Require Package
21
+
22
+ ```
23
+ composer require zschuessler/laravel-route-to-class
24
+ ```
25
+
26
+ ### 2 - Add Service Provider to Your App
27
+
28
+ Add the following line under the ` providers ` array key in * app/config.php* :
29
+
30
+ ``` php
31
+ /**
32
+ * Custom Service Providers
33
+ */
34
+ Zschuessler\RouteToClass\ServiceProvider::class,
35
+ ```
36
+
37
+ ### 3 - Use It
38
+
39
+ You now have access to a shared view variable ` $route_body_class ` . Use it in any of your views like so:
40
+
41
+ ``` php
42
+ <body class =" {{ $route_body_classes ))" >
43
+ ```
44
+
45
+ ## License
46
+
47
+ This is public domain. Do what you want.
You can’t perform that action at this time.
0 commit comments