1 | <?php |
||
11 | class Menu extends BaseMenu implements Htmlable |
||
12 | { |
||
13 | use Macroable; |
||
14 | |||
15 | /** |
||
16 | * Set all relevant children active based on the current request's URL. |
||
17 | * |
||
18 | * /, /about, /contact => request to /about will set the about link active. |
||
19 | * |
||
20 | * /en, /en/about, /en/contact => request to /en won't set /en active if the |
||
21 | * request root is set to /en. |
||
22 | * |
||
23 | * @param string $requestRoot If the link's URL is an exact match with the |
||
24 | * request root, the link won't be set active. |
||
25 | * This behavior is to avoid having home links |
||
26 | * active on every request. |
||
27 | * |
||
28 | * @return $this |
||
29 | */ |
||
30 | public function setActiveFromRequest(string $requestRoot = '') |
||
34 | |||
35 | /** |
||
36 | * @param string $path |
||
37 | * @param string $text |
||
38 | * @param array $parameters |
||
39 | * @param bool|null $secure |
||
40 | * |
||
41 | * @return $this |
||
42 | */ |
||
43 | public function url(string $path, string $text, array $parameters = [], $secure = null) |
||
47 | |||
48 | /** |
||
49 | * @param string $action |
||
50 | * @param string $text |
||
51 | * @param array $parameters |
||
52 | * @param bool $absolute |
||
53 | * |
||
54 | * @return $this |
||
55 | */ |
||
56 | public function action(string $action, string $text, array $parameters = [], bool $absolute = true) |
||
60 | |||
61 | /** |
||
62 | * @param string $name |
||
63 | * @param string $text |
||
64 | * @param array $parameters |
||
65 | * @param bool $absolute |
||
66 | * @param \Illuminate\Routing\Route|null $route |
||
67 | * |
||
68 | * @return $this |
||
69 | */ |
||
70 | public function route(string $name, string $text, array $parameters = [], bool $absolute = true, $route = null) |
||
74 | |||
75 | /** |
||
76 | * @param bool $condition |
||
77 | * @param string $path |
||
78 | * @param string $text |
||
79 | * @param array $parameters |
||
80 | * @param bool|null $secure |
||
81 | * |
||
82 | * @return $this |
||
83 | */ |
||
84 | public function urlIf($condition, string $path, string $text, array $parameters = [], $secure = null) |
||
88 | |||
89 | /** |
||
90 | * @param bool $condition |
||
91 | * @param string $action |
||
92 | * @param string $text |
||
93 | * @param array $parameters |
||
94 | * @param bool $absolute |
||
95 | * |
||
96 | * @return $this |
||
97 | */ |
||
98 | public function actionIf($condition, string $action, string $text, array $parameters = [], bool $absolute = true) |
||
102 | |||
103 | /** |
||
104 | * @param bool $condition |
||
105 | * @param string $name |
||
106 | * @param string $text |
||
107 | * @param array $parameters |
||
108 | * @param bool $absolute |
||
109 | * @param \Illuminate\Routing\Route|null $route |
||
110 | * |
||
111 | * @return $this |
||
112 | */ |
||
113 | public function routeIf($condition, string $name, string $text, array $parameters = [], bool $absolute = true, $route = null) |
||
117 | |||
118 | /** |
||
119 | * @param string|array $authorization |
||
120 | * @param \Spatie\Menu\Item $item |
||
121 | * |
||
122 | * @return $this |
||
123 | */ |
||
124 | public function addIfCan($authorization, Item $item) |
||
131 | |||
132 | /** |
||
133 | * @param string|array $authorization |
||
134 | * @param string $url |
||
135 | * @param string $text |
||
136 | * |
||
137 | * @return $this |
||
138 | */ |
||
139 | public function linkIfCan($authorization, string $url, string $text) |
||
143 | |||
144 | /** |
||
145 | * @param string|array $authorization |
||
146 | * @param string $html |
||
147 | * |
||
148 | * @return \Spatie\Menu\Laravel\Menu |
||
149 | */ |
||
150 | public function htmlIfCan($authorization, string $html) |
||
154 | |||
155 | /** |
||
156 | * @param string|array $authorization |
||
157 | * @param string $path |
||
158 | * @param string $text |
||
159 | * @param array $parameters |
||
160 | * @param bool|null $secure |
||
161 | * |
||
162 | * @return $this |
||
163 | */ |
||
164 | public function urlIfCan($authorization, string $path, string $text, array $parameters = [], $secure = null) |
||
168 | |||
169 | /** |
||
170 | * @param string|array $authorization |
||
171 | * @param string $action |
||
172 | * @param string $text |
||
173 | * @param array $parameters |
||
174 | * @param bool $absolute |
||
175 | * |
||
176 | * @return $this |
||
177 | */ |
||
178 | public function actionIfCan($authorization, string $action, string $text, array $parameters = [], bool $absolute = true) |
||
182 | |||
183 | /** |
||
184 | * @param string|array $authorization |
||
185 | * @param string $name |
||
186 | * @param string $text |
||
187 | * @param array $parameters |
||
188 | * @param bool $absolute |
||
189 | * @param \Illuminate\Routing\Route|null $route |
||
190 | * |
||
191 | * @return $this |
||
192 | */ |
||
193 | public function routeIfCan($authorization, string $name, string $text, array $parameters = [], bool $absolute = true, $route = null) |
||
197 | |||
198 | /** |
||
199 | * @return string |
||
200 | */ |
||
201 | public function toHtml() : string |
||
205 | } |
||
206 |