File tree 1 file changed +35
-2
lines changed
1 file changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -17,15 +17,48 @@ composer require permafrost-dev/laravel-current-route
17
17
```
18
18
---
19
19
20
+ #### Helper Functions
21
+
22
+ ``` php
23
+
24
+ // Return a Laravel Route object for the current route.
25
+ function current_route();
26
+
27
+ // Return a class containing information about the current route.
28
+ function current_route_info();
29
+
30
+ // Return the action for the current route.
31
+ function current_route_action();
32
+
33
+ // Return true if one of the specified wildcard patterns matches the name of the current route.
34
+ function current_route_matches($patterns);
35
+
36
+ // Return the name for the current route.
37
+ function current_route_name();
38
+
39
+ // Returns true if $name matches the name of the current route.
40
+ function current_route_named($name);
41
+ ```
42
+
20
43
#### Usage
21
- WIP
44
+
45
+ _ WIP_
46
+
47
+ #### Examples
48
+
49
+ Use ` current_route_named() ` to generate conditional css classes in a blade template:
50
+ ``` html
51
+ <a class =" {{ current_route_named('dashboard') ? 'active' : 'inactive' }}"
52
+ href =" {{ route('dashboard') }}" >Dashboard
53
+ </a >
54
+ ```
22
55
23
56
---
24
57
25
58
#### Testing
26
59
27
60
``` bash
28
- $ vendor/bin/phpunit tests
61
+ $ vendor/bin/phpunit
29
62
```
30
63
31
64
---
You can’t perform that action at this time.
0 commit comments