Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c8c2635
commit 47d0fe1
Showing
3 changed files
with
50 additions
and
29 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php namespace Modules\Workshop\Sidebar; | ||
|
||
use Maatwebsite\Sidebar\Group; | ||
use Maatwebsite\Sidebar\Item; | ||
use Maatwebsite\Sidebar\Menu; | ||
use Modules\Core\Contracts\Authentication; | ||
|
||
class SidebarExtender implements \Maatwebsite\Sidebar\SidebarExtender | ||
{ | ||
/** | ||
* @var Authentication | ||
*/ | ||
protected $auth; | ||
|
||
/** | ||
* @param Authentication $auth | ||
* | ||
* @internal param Guard $guard | ||
*/ | ||
public function __construct(Authentication $auth) | ||
{ | ||
$this->auth = $auth; | ||
} | ||
|
||
/** | ||
* @param Menu $menu | ||
* | ||
* @return Menu | ||
*/ | ||
public function extendWith(Menu $menu) | ||
{ | ||
$menu->group(trans('workshop::workshop.title'), function (Group $group) { | ||
$group->weight(100); | ||
$group->authorize( | ||
$this->auth->hasAccess('workshop.modules.index') or $this->auth->hasAccess('workshop.workbench.index') | ||
); | ||
|
||
$group->item(trans('workshop::workshop.modules'), function (Item $item) { | ||
$item->icon('fa fa-cogs'); | ||
$item->weight(100); | ||
$item->route('admin.workshop.modules.index'); | ||
$item->authorize( | ||
$this->auth->hasAccess('workshop.modules.index') | ||
); | ||
}); | ||
}); | ||
|
||
return $menu; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters