Skip to content

Commit 7d4b104

Browse files
Merge branch 'master' into develop
2 parents 59cc51a + d631d53 commit 7d4b104

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/Item.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Hexadog\MenusManager;
44

5+
use Closure;
56
use Hexadog\MenusManager\Traits\HasItems;
67
use Illuminate\Contracts\Support\Arrayable;
78
use Illuminate\Support\Arr;
@@ -78,7 +79,7 @@ public function __get($key)
7879

7980
$value = Arr::get($this->properties, $key);
8081

81-
if ($value instanceof \Closure) {
82+
if ($value instanceof Closure) {
8283
$value = $value();
8384
}
8485

src/Traits/HasItems.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Hexadog\MenusManager\Traits;
44

5+
use Closure;
56
use Hexadog\MenusManager\Item;
67
use Illuminate\Support\Collection;
78

@@ -70,7 +71,7 @@ public function findBy(string $key, string $value): ?Item
7071
*/
7172
public function findByTitleOrAdd(string|\Closure $title, array $attributes = []): ?Item
7273
{
73-
if (!($item = $this->findBy('title', $title instanceof \Closure ? $title() : $title))) {
74+
if (!($item = $this->findBy('title', $title instanceof Closure ? $title() : $title))) {
7475
$item = $this->add(compact('title', 'attributes'));
7576
}
7677

@@ -80,7 +81,7 @@ public function findByTitleOrAdd(string|\Closure $title, array $attributes = [])
8081
/**
8182
* Add new header menu item.
8283
*/
83-
public function header(string|\Closure $title, array $attributes = []): Item
84+
public function header(string|Closure $title, array $attributes = []): Item
8485
{
8586
return $this->add(compact('title', 'attributes'))->asHeader();
8687
}
@@ -102,15 +103,15 @@ public function items()
102103
*
103104
* @param mixed $route
104105
*/
105-
public function route($route, string|\Closure $title, array $attributes = []): Item
106+
public function route($route, string|Closure $title, array $attributes = []): Item
106107
{
107108
return $this->add(compact('route', 'title', 'attributes'));
108109
}
109110

110111
/**
111112
* Register new menu item using url.
112113
*/
113-
public function url(string $url, string|\Closure $title, array $attributes = []): Item
114+
public function url(string $url, string|Closure $title, array $attributes = []): Item
114115
{
115116
return $this->add(compact('url', 'title', 'attributes'));
116117
}

0 commit comments

Comments
 (0)