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 string $name |
||
77 | * @param array $data |
||
78 | * |
||
79 | * @return $this |
||
80 | */ |
||
81 | public function view(string $name, array $data = []) |
||
85 | |||
86 | /** |
||
87 | * @param bool $condition |
||
88 | * @param string $path |
||
89 | * @param string $text |
||
90 | * @param array $parameters |
||
91 | * @param bool|null $secure |
||
92 | * |
||
93 | * @return $this |
||
94 | */ |
||
95 | public function urlIf($condition, string $path, string $text, array $parameters = [], $secure = null) |
||
99 | |||
100 | /** |
||
101 | * @param bool $condition |
||
102 | * @param string $action |
||
103 | * @param string $text |
||
104 | * @param array $parameters |
||
105 | * @param bool $absolute |
||
106 | * |
||
107 | * @return $this |
||
108 | */ |
||
109 | public function actionIf($condition, string $action, string $text, array $parameters = [], bool $absolute = true) |
||
113 | |||
114 | /** |
||
115 | * @param bool $condition |
||
116 | * @param string $name |
||
117 | * @param string $text |
||
118 | * @param array $parameters |
||
119 | * @param bool $absolute |
||
120 | * @param \Illuminate\Routing\Route|null $route |
||
121 | * |
||
122 | * @return $this |
||
123 | */ |
||
124 | public function routeIf($condition, string $name, string $text, array $parameters = [], bool $absolute = true, $route = null) |
||
128 | |||
129 | /** |
||
130 | * @param $condition |
||
131 | * @param string $name |
||
132 | * @param array $data |
||
133 | * |
||
134 | * @return $this |
||
135 | */ |
||
136 | public function viewIf($condition, string $name, array $data) |
||
140 | |||
141 | /** |
||
142 | * @param string|array $authorization |
||
143 | * @param \Spatie\Menu\Item $item |
||
144 | * |
||
145 | * @return $this |
||
146 | */ |
||
147 | public function addIfCan($authorization, Item $item) |
||
154 | |||
155 | /** |
||
156 | * @param string|array $authorization |
||
157 | * @param string $url |
||
158 | * @param string $text |
||
159 | * |
||
160 | * @return $this |
||
161 | */ |
||
162 | public function linkIfCan($authorization, string $url, string $text) |
||
166 | |||
167 | /** |
||
168 | * @param string|array $authorization |
||
169 | * @param string $html |
||
170 | * |
||
171 | * @return \Spatie\Menu\Laravel\Menu |
||
172 | */ |
||
173 | public function htmlIfCan($authorization, string $html) |
||
177 | |||
178 | /** |
||
179 | * @param string|array $authorization |
||
180 | * @param callable|\Spatie\Menu\Menu|\Spatie\Menu\Item $header |
||
181 | * @param callable|\Spatie\Menu\Menu|null $menu |
||
182 | * |
||
183 | * @return $this |
||
184 | */ |
||
185 | public function submenuIfCan($authorization, $header, $menu = null) |
||
194 | |||
195 | protected function parseSubmenuIfCanArgs($authorization, ...$args): array |
||
199 | |||
200 | /** |
||
201 | * @param string|array $authorization |
||
202 | * @param string $path |
||
203 | * @param string $text |
||
204 | * @param array $parameters |
||
205 | * @param bool|null $secure |
||
206 | * |
||
207 | * @return $this |
||
208 | */ |
||
209 | public function urlIfCan($authorization, string $path, string $text, array $parameters = [], $secure = null) |
||
213 | |||
214 | /** |
||
215 | * @param string|array $authorization |
||
216 | * @param string $action |
||
217 | * @param string $text |
||
218 | * @param array $parameters |
||
219 | * @param bool $absolute |
||
220 | * |
||
221 | * @return $this |
||
222 | */ |
||
223 | public function actionIfCan($authorization, string $action, string $text, array $parameters = [], bool $absolute = true) |
||
227 | |||
228 | /** |
||
229 | * @param string|array $authorization |
||
230 | * @param string $name |
||
231 | * @param string $text |
||
232 | * @param array $parameters |
||
233 | * @param bool $absolute |
||
234 | * @param \Illuminate\Routing\Route|null $route |
||
235 | * |
||
236 | * @return $this |
||
237 | */ |
||
238 | public function routeIfCan($authorization, string $name, string $text, array $parameters = [], bool $absolute = true, $route = null) |
||
242 | |||
243 | /** |
||
244 | * @param $condition |
||
245 | * @param string $name |
||
246 | * @param array $data |
||
247 | * |
||
248 | * @return $this |
||
249 | */ |
||
250 | public function viewIfCan($authorization, string $name, array $data) |
||
254 | |||
255 | /** |
||
256 | * @return string |
||
257 | */ |
||
258 | public function toHtml() : string |
||
262 | } |
||
263 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.