Skip to content

Commit

Permalink
Workshop sidebar extender
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickbrouwers committed Jun 21, 2015
1 parent c8c2635 commit 47d0fe1
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 29 deletions.
28 changes: 0 additions & 28 deletions Composers/SidebarViewComposer.php

This file was deleted.

50 changes: 50 additions & 0 deletions Sidebar/SidebarExtender.php
@@ -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;
}
}
1 change: 0 additions & 1 deletion composers.php
@@ -1,6 +1,5 @@
<?php

View::composer('partials.sidebar-nav', 'Modules\Workshop\Composers\SidebarViewComposer');
View::composer([
'workshop::admin.workbench.tabs.migrate',
'workshop::admin.workbench.tabs.seed',
Expand Down

0 comments on commit 47d0fe1

Please sign in to comment.