Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
laravel-adminpanel
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
laravel-adminpanel
Commits
65338fbd
Commit
65338fbd
authored
Jun 03, 2018
by
Vipul Basapati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Menu Module Responsable Actions complete
parent
a5a0e4cd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
141 additions
and
38 deletions
+141
-38
MenuController.php
app/Http/Controllers/Backend/Menu/MenuController.php
+50
-38
CreateResponse.php
app/Http/Responses/Backend/Menu/CreateResponse.php
+42
-0
EditResponse.php
app/Http/Responses/Backend/Menu/EditResponse.php
+49
-0
No files found.
app/Http/Controllers/Backend/Menu/MenuController.php
View file @
65338fbd
...
...
@@ -2,27 +2,59 @@
namespace
App\Http\Controllers\Backend\Menu
;
use
App\Models\Menu\Menu
;
use
Bvipul\Generator\Module
;
use
Illuminate\Support\Facades\DB
;
use
App\Http\Controllers\Controller
;
use
App\Http\Responses\ViewResponse
;
use
App\Http\Responses\RedirectResponse
;
use
App\Http\Responses\Backend\Menu\EditResponse
;
use
App\Repositories\Backend\Menu\MenuRepository
;
use
App\Http\Requests\Backend\Menu\EditMenuRequest
;
use
App\Http\Responses\Backend\Menu\CreateResponse
;
use
App\Http\Requests\Backend\Menu\StoreMenuRequest
;
use
App\Http\Requests\Backend\Menu\CreateMenuRequest
;
use
App\Http\Requests\Backend\Menu\DeleteMenuRequest
;
use
App\Http\Requests\Backend\Menu\EditMenuRequest
;
use
App\Http\Requests\Backend\Menu\ManageMenuRequest
;
use
App\Http\Requests\Backend\Menu\StoreMenuRequest
;
use
App\Http\Requests\Backend\Menu\UpdateMenuRequest
;
use
App\Models\Menu\Menu
;
use
App\Repositories\Backend\Menu\MenuRepository
;
use
Illuminate\Support\Facades\DB
;
class
MenuController
extends
Controller
{
/**
* Menu Model Object
*
* @var \App\Models\Menu\Menu
*/
protected
$menu
;
/**
* Module Model Object
*
* @var \Bvipul\Generator\Module
*/
protected
$modules
;
/**
* Menu Types
*
* @var Array
*/
protected
$types
;
/**
* @param \App\Repositories\Backend\Menu\MenuRepository $menu
*/
public
function
__construct
(
MenuRepository
$menu
)
public
function
__construct
(
MenuRepository
$menu
,
Module
$module
)
{
$this
->
menu
=
$menu
;
$this
->
modules
=
$module
;
$this
->
types
=
[
'backend'
=>
'Backend'
,
'frontend'
=>
'Frontend'
,
];
}
/**
...
...
@@ -30,11 +62,11 @@ class MenuController extends Controller
*
* @param \App\Http\Requests\Backend\Menu\ManageMenuRequest $request
*
* @return \
Illuminate\Http\
Response
* @return \
App\Http\Responses\View
Response
*/
public
function
index
(
ManageMenuRequest
$request
)
{
return
view
(
'backend.menus.index'
);
return
new
ViewResponse
(
'backend.menus.index'
);
}
/**
...
...
@@ -42,17 +74,11 @@ class MenuController extends Controller
*
* @param \App\Http\Requests\Backend\Menu\CreateMenuRequest $request
*
* @return \
Illuminate\Http\
Response
* @return \
App\Http\Responses\Backend\Menu\Create
Response
*/
public
function
create
(
CreateMenuRequest
$request
)
{
$types
=
[
'backend'
=>
'Backend'
,
'frontend'
=>
'Frontend'
,
];
$modules
=
DB
::
table
(
'modules'
)
->
get
();
return
view
(
'backend.menus.create'
)
->
withTypes
(
$types
)
->
withModules
(
$modules
);
return
new
CreateResponse
(
$this
->
types
,
$this
->
modules
);
}
/**
...
...
@@ -60,13 +86,13 @@ class MenuController extends Controller
*
* @param \App\Http\Requests\Backend\Menu\StoreMenuRequest $request
*
* @return \
Illuminate\Http\
Response
* @return \
App\Http\Responses\Redirect
Response
*/
public
function
store
(
StoreMenuRequest
$request
)
{
$this
->
menu
->
create
(
$request
->
except
(
'_token'
));
return
redirect
()
->
route
(
'admin.menus.index'
)
->
withFlashSuccess
(
trans
(
'alerts.backend.menus.created'
)
);
return
new
RedirectResponse
(
'admin.menus.index'
,
[
'flash_success'
=>
trans
(
'alerts.backend.menus.created'
)]
);
}
/**
...
...
@@ -75,21 +101,11 @@ class MenuController extends Controller
* @param \App\Models\Menu\Menu $menu
* @param \App\Http\Requests\Backend\Menu\EditMenuRequest $request
*
* @return \
Illuminate\Http\
Response
* @return \
App\Http\Responses\Backend\Menu\Edit
Response
*/
public
function
edit
(
Menu
$menu
,
EditMenuRequest
$request
)
{
$types
=
[
'backend'
=>
'Backend'
,
'frontend'
=>
'Frontend'
,
];
$modules
=
DB
::
table
(
'modules'
)
->
get
();
return
view
(
'backend.menus.edit'
)
->
with
(
'types'
,
$types
)
->
with
(
'menu'
,
$menu
)
->
with
(
'modules'
,
$modules
);
return
new
EditResponse
(
$menu
,
$this
->
types
,
$this
->
modules
);
}
/**
...
...
@@ -98,15 +114,13 @@ class MenuController extends Controller
* @param \App\Models\Menu\Menu $menu
* @param \App\Http\Requests\Backend\Menu\UpdateMenuRequest $request
*
* @return \
Illuminate\Http\
Response
* @return \
App\Http\Responses\Redirect
Response
*/
public
function
update
(
Menu
$menu
,
UpdateMenuRequest
$request
)
{
$this
->
menu
->
update
(
$menu
,
$request
->
all
());
return
redirect
()
->
route
(
'admin.menus.index'
)
->
with
(
'flash_success'
,
trans
(
'alerts.backend.menus.updated'
));
return
new
RedirectResponse
(
'admin.menus.index'
,
[
'flash_success'
=>
trans
(
'alerts.backend.menus.updated'
)]);
}
/**
...
...
@@ -115,14 +129,12 @@ class MenuController extends Controller
* @param \App\Models\Menu\Menu $menu
* @param \App\Http\Requests\Backend\Menu\DeleteMenuRequest $request
*
* @return \
Illuminate\Http\
Response
* @return \
App\Http\Responses\Redirect
Response
*/
public
function
destroy
(
Menu
$menu
,
DeleteMenuRequest
$request
)
{
$this
->
menu
->
delete
(
$menu
);
return
redirect
()
->
route
(
'admin.menus.index'
)
->
with
(
'flash_success'
,
trans
(
'alerts.backend.menus.deleted'
));
return
new
RedirectResponse
(
'admin.menus.index'
,
[
'flash_success'
=>
trans
(
'alerts.backend.menus.deleted'
)]);
}
}
app/Http/Responses/Backend/Menu/CreateResponse.php
0 → 100644
View file @
65338fbd
<?php
namespace
App\Http\Responses\Backend\Menu
;
use
Illuminate\Contracts\Support\Responsable
;
class
CreateResponse
implements
Responsable
{
/**
* @var Array
*/
protected
$types
;
/**
* @var \Bvipul\Generator\Module
*/
protected
$modules
;
/**
* @param Array $types
* @param \Bvipul\Generator\Module $modules
*/
public
function
__construct
(
$types
,
$modules
)
{
$this
->
types
=
$types
;
$this
->
modules
=
$modules
;
}
/**
* In Response.
*
* @param \App\Http\Requests\Request $request
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public
function
toResponse
(
$request
)
{
return
view
(
'backend.menus.create'
)
->
withTypes
(
$this
->
types
)
->
withModules
(
$this
->
modules
->
all
());
}
}
app/Http/Responses/Backend/Menu/EditResponse.php
0 → 100644
View file @
65338fbd
<?php
namespace
App\Http\Responses\Backend\Menu
;
use
Illuminate\Contracts\Support\Responsable
;
class
EditResponse
implements
Responsable
{
/**
* @var Array
*/
protected
$types
;
/**
* @var \Bvipul\Generator\Module
*/
protected
$modules
;
/**
* @var \App\Models\Menu\Menu
*/
protected
$menu
;
/**
* @param \App\Models\Menu\Menu $menu
* @param Array $types
* @param \Bvipul\Generator\Module $modules
*/
public
function
__construct
(
$menu
,
$types
,
$modules
)
{
$this
->
menu
=
$menu
;
$this
->
types
=
$types
;
$this
->
modules
=
$modules
;
}
/**
* toReponse
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public
function
toResponse
(
$request
)
{
return
view
(
'backend.menus.edit'
)
->
with
(
'types'
,
$this
->
types
)
->
with
(
'menu'
,
$this
->
menu
)
->
with
(
'modules'
,
$this
->
modules
->
all
());
}
}
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