Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
a499d2a9
Unverified
Commit
a499d2a9
authored
Jul 18, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Register the dashboard module sidebar via event handler
parent
72753ef4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
4 deletions
+18
-4
RegisterDashboardSidebar.php
...es/Dashboard/Events/Handlers/RegisterDashboardSidebar.php
+9
-3
DashboardServiceProvider.php
Modules/Dashboard/Providers/DashboardServiceProvider.php
+9
-1
No files found.
Modules/Dashboard/
Sidebar/SidebarExtende
r.php
→
Modules/Dashboard/
Events/Handlers/RegisterDashboardSideba
r.php
View file @
a499d2a9
<?php
namespace
Modules\Dashboard\
Sidebar
;
namespace
Modules\Dashboard\
Events\Handlers
;
use
Maatwebsite\Sidebar\Group
;
use
Maatwebsite\Sidebar\Item
;
use
Maatwebsite\Sidebar\Menu
;
use
Maatwebsite\Sidebar\SidebarExtender
;
use
Modules\Core\Events\BuildingSidebar
;
use
Modules\User\Contracts\Authentication
;
class
SidebarExtender
implements
\Maatwebsite\Sidebar\
SidebarExtender
class
RegisterDashboardSidebar
implements
SidebarExtender
{
/**
* @var Authentication
...
...
@@ -24,9 +26,13 @@ class SidebarExtender implements \Maatwebsite\Sidebar\SidebarExtender
$this
->
auth
=
$auth
;
}
public
function
handle
(
BuildingSidebar
$sidebar
)
{
$sidebar
->
add
(
$this
->
extendWith
(
$sidebar
->
getMenu
()));
}
/**
* @param Menu $menu
*
* @return Menu
*/
public
function
extendWith
(
Menu
$menu
)
...
...
Modules/Dashboard/Providers/DashboardServiceProvider.php
View file @
a499d2a9
...
...
@@ -3,8 +3,11 @@
namespace
Modules\Dashboard\Providers
;
use
Illuminate\Support\ServiceProvider
;
use
Modules\Core\Events\BuildingSidebar
;
use
Modules\Core\Traits\CanGetSidebarClassForModule
;
use
Modules\Core\Traits\CanPublishConfiguration
;
use
Modules\Dashboard\Entities\Widget
;
use
Modules\Dashboard\Events\Handlers\RegisterDashboardSidebar
;
use
Modules\Dashboard\Repositories\Cache\CacheWidgetDecorator
;
use
Modules\Dashboard\Repositories\Eloquent\EloquentWidgetRepository
;
use
Modules\Dashboard\Repositories\WidgetRepository
;
...
...
@@ -12,7 +15,7 @@ use Modules\Workshop\Manager\StylistThemeManager;
class
DashboardServiceProvider
extends
ServiceProvider
{
use
CanPublishConfiguration
;
use
CanPublishConfiguration
,
CanGetSidebarClassForModule
;
/**
* Indicates if loading of the provider is deferred.
*
...
...
@@ -36,6 +39,11 @@ class DashboardServiceProvider extends ServiceProvider
return
new
CacheWidgetDecorator
(
$repository
);
});
$this
->
app
[
'events'
]
->
listen
(
BuildingSidebar
::
class
,
$this
->
getSidebarClassForModule
(
'dashboard'
,
RegisterDashboardSidebar
::
class
)
);
}
public
function
boot
(
StylistThemeManager
$theme
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment