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
6299fa27
Commit
6299fa27
authored
Sep 24, 2014
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding the role update and destroy methods
parent
18fc99c7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
3 deletions
+44
-3
RolesController.php
Http/Controllers/Admin/RolesController.php
+20
-3
UpdateRoleRequest.php
Http/Requests/UpdateRoleRequest.php
+24
-0
No files found.
Http/Controllers/Admin/RolesController.php
View file @
6299fa27
...
...
@@ -6,6 +6,7 @@ use Illuminate\Support\Facades\View;
use
Laracasts\Flash\Flash
;
use
Modules\Core\Http\Controllers\Admin\AdminBaseController
;
use
Modules\User\Http\Requests\CreateRolesRequest
;
use
Modules\User\Http\Requests\UpdateRoleRequest
;
class
RolesController
extends
AdminBaseController
{
...
...
@@ -83,11 +84,19 @@ class RolesController extends AdminBaseController
* Update the specified resource in storage.
*
* @param int $id
* @param UpdateRoleRequest $request
* @return Response
*/
public
function
update
(
$id
)
public
function
update
(
$id
,
UpdateRoleRequest
$request
)
{
//
$role
=
$this
->
roles
->
find
(
$id
);
$role
->
fill
(
$request
->
all
());
$role
->
save
();
Flash
::
success
(
'Role updated!'
);
return
Redirect
::
route
(
'dashboard.role.index'
);
}
/**
...
...
@@ -98,6 +107,14 @@ class RolesController extends AdminBaseController
*/
public
function
destroy
(
$id
)
{
//
if
(
$role
=
$this
->
roles
->
find
(
$id
))
{
$role
->
delete
();
Flash
::
success
(
'Role deleted!'
);
return
Redirect
::
route
(
'dashboard.role.index'
);
}
return
Redirect
::
route
(
'dashboard.role.index'
);
}
}
\ No newline at end of file
Http/Requests/UpdateRoleRequest.php
0 → 100644
View file @
6299fa27
<?php
namespace
Modules\User\Http\Requests
;
use
Illuminate\Foundation\Http\FormRequest
;
class
UpdateRoleRequest
extends
FormRequest
{
public
function
rules
()
{
return
[
'name'
=>
'required'
,
'slug'
=>
'required'
,
];
}
public
function
authorize
()
{
return
true
;
}
public
function
messages
()
{
return
[];
}
}
\ No newline at end of file
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