@@ 350-370 (lines=21) @@ | ||
347 | * |
|
348 | * @return $this |
|
349 | */ |
|
350 | public function dropdown($title, \Closure $callback, $order = null, array $attributes = array()) |
|
351 | { |
|
352 | $properties = compact('title', 'order', 'attributes'); |
|
353 | ||
354 | if (func_num_args() == 3) { |
|
355 | $arguments = func_get_args(); |
|
356 | ||
357 | $title = Arr::get($arguments, 0); |
|
358 | $attributes = Arr::get($arguments, 2); |
|
359 | ||
360 | $properties = compact('title', 'attributes'); |
|
361 | } |
|
362 | ||
363 | $item = MenuItem::make($properties); |
|
364 | ||
365 | call_user_func($callback, $item); |
|
366 | ||
367 | $this->items[] = $item; |
|
368 | ||
369 | return $item; |
|
370 | } |
|
371 | ||
372 | /** |
|
373 | * Register new menu item using registered route. |
@@ 152-172 (lines=21) @@ | ||
149 | * |
|
150 | * @return $this |
|
151 | */ |
|
152 | public function dropdown($title, \Closure $callback, $order = 0, array $attributes = array()) |
|
153 | { |
|
154 | $properties = compact('title', 'order', 'attributes'); |
|
155 | ||
156 | if (func_num_args() === 3) { |
|
157 | $arguments = func_get_args(); |
|
158 | ||
159 | $title = Arr::get($arguments, 0); |
|
160 | $attributes = Arr::get($arguments, 2); |
|
161 | ||
162 | $properties = compact('title', 'attributes'); |
|
163 | } |
|
164 | ||
165 | $child = static::make($properties); |
|
166 | ||
167 | call_user_func($callback, $child); |
|
168 | ||
169 | $this->childs[] = $child; |
|
170 | ||
171 | return $child; |
|
172 | } |
|
173 | ||
174 | /** |
|
175 | * Create new menu item and set the action to route. |