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
b962e595
Unverified
Commit
b962e595
authored
Sep 14, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Injecting the repository interface instead of the concrete implementation
parent
dccf9d15
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
9 deletions
+9
-9
DashboardController.php
.../Dashboard/Http/Controllers/Admin/DashboardController.php
+5
-5
ModulesController.php
...les/Workshop/Http/Controllers/Admin/ModulesController.php
+3
-3
backendRoutes.php
Modules/Workshop/Http/backendRoutes.php
+1
-1
No files found.
Modules/Dashboard/Http/Controllers/Admin/DashboardController.php
View file @
b962e595
...
...
@@ -7,7 +7,7 @@ use Illuminate\Support\Facades\Response;
use
Modules\Core\Http\Controllers\Admin\AdminBaseController
;
use
Modules\Dashboard\Repositories\WidgetRepository
;
use
Modules\User\Contracts\Authentication
;
use
Nwidart\Modules\
Repository
;
use
Nwidart\Modules\
Contracts\RepositoryInterface
;
class
DashboardController
extends
AdminBaseController
{
...
...
@@ -21,11 +21,11 @@ class DashboardController extends AdminBaseController
private
$auth
;
/**
* @param Repository $modules
* @param Repository
Interface
$modules
* @param WidgetRepository $widget
* @param Authentication $auth
*/
public
function
__construct
(
Repository
$modules
,
WidgetRepository
$widget
,
Authentication
$auth
)
public
function
__construct
(
Repository
Interface
$modules
,
WidgetRepository
$widget
,
Authentication
$auth
)
{
parent
::
__construct
();
$this
->
bootWidgets
(
$modules
);
...
...
@@ -87,9 +87,9 @@ class DashboardController extends AdminBaseController
/**
* Boot widgets for all enabled modules
* @param Repository $modules
* @param Repository
Interface
$modules
*/
private
function
bootWidgets
(
Repository
$modules
)
private
function
bootWidgets
(
Repository
Interface
$modules
)
{
foreach
(
$modules
->
enabled
()
as
$module
)
{
if
(
!
$module
->
widgets
)
{
...
...
Modules/Workshop/Http/Controllers/Admin/ModulesController.php
View file @
b962e595
...
...
@@ -9,7 +9,7 @@ use Illuminate\Support\Facades\View;
use
Modules\Core\Http\Controllers\Admin\AdminBaseController
;
use
Modules\Workshop\Manager\ModuleManager
;
use
Nwidart\Modules\Module
;
use
Nwidart\Modules\
Repository
;
use
Nwidart\Modules\
Contracts\RepositoryInterface
;
use
Symfony\Component\Console\Output\BufferedOutput
;
class
ModulesController
extends
AdminBaseController
...
...
@@ -19,11 +19,11 @@ class ModulesController extends AdminBaseController
*/
private
$moduleManager
;
/**
* @var Repository
* @var Repository
Interface
*/
private
$modules
;
public
function
__construct
(
ModuleManager
$moduleManager
,
Repository
$modules
)
public
function
__construct
(
ModuleManager
$moduleManager
,
Repository
Interface
$modules
)
{
parent
::
__construct
();
...
...
Modules/Workshop/Http/backendRoutes.php
View file @
b962e595
...
...
@@ -4,7 +4,7 @@ use Illuminate\Routing\Router;
/** @var Router $router */
$router
->
bind
(
'module'
,
function
(
$module
)
{
return
app
(
\Nwidart\Modules\
Repository
::
class
)
->
find
(
$module
);
return
app
(
\Nwidart\Modules\
Contracts\RepositoryInterface
::
class
)
->
find
(
$module
);
});
$router
->
bind
(
'theme'
,
function
(
$theme
)
{
return
app
(
\Modules\Workshop\Manager\ThemeManager
::
class
)
->
find
(
$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