Skip to content

Commit

Permalink
Merge pull request #2 from queents/dev
Browse files Browse the repository at this point in the history
add menu sorting and show
  • Loading branch information
3x1io authored Oct 10, 2022
2 parents 03cfa3f + b046caa commit 3e36ab9
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions Services/Resource/Concerns/Core/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,32 @@

trait Menu
{
public ?int $sorting = 1;
public ?bool $menu = true;

/**
* @return array
*/
public function menus(): array
{
$menus = [
\Modules\Base\Services\Components\Base\Menu::make(Str::ucfirst($this->table))
->label($this->table . '.sidebar')
->icon($this->icon)
->route($this->table . '.index')
->group($this->group)
->can('view_any_' . $this->table)
->sort(1)
];
if ($this->menu) {
$menus = [
\Modules\Base\Services\Components\Base\Menu::make(Str::ucfirst($this->table))
->label($this->table . '.sidebar')
->icon($this->icon)
->route($this->table . '.index')
->group($this->group)
->can('view_any_' . $this->table)
->sort($this->sorting)
];
} else {
$menus = [];
}

return array_merge($menus, $this->menu());
}


/**
* @return array
*/
Expand Down

0 comments on commit 3e36ab9

Please sign in to comment.