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
b6ce3745
Unverified
Commit
b6ce3745
authored
Oct 11, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Creating a create role request
parent
8f86b43c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
11 deletions
+35
-11
RolesController.php
Modules/User/Http/Controllers/Admin/RolesController.php
+5
-7
CreateRoleRequest.php
Modules/User/Http/Requests/CreateRoleRequest.php
+2
-4
UpdateRoleRequest.php
Modules/User/Http/Requests/UpdateRoleRequest.php
+28
-0
No files found.
Modules/User/Http/Controllers/Admin/RolesController.php
View file @
b6ce3745
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
namespace
Modules\User\Http\Controllers\Admin
;
namespace
Modules\User\Http\Controllers\Admin
;
use
Modules\User\Http\Requests\
Roles
Request
;
use
Modules\User\Http\Requests\
UpdateRole
Request
;
use
Modules\User\Permissions\PermissionManager
;
use
Modules\User\Permissions\PermissionManager
;
use
Modules\User\Repositories\RoleRepository
;
use
Modules\User\Repositories\RoleRepository
;
...
@@ -45,11 +45,10 @@ class RolesController extends BaseUserModuleController
...
@@ -45,11 +45,10 @@ class RolesController extends BaseUserModuleController
/**
/**
* Store a newly created resource in storage.
* Store a newly created resource in storage.
*
* @param UpdateRoleRequest $request
* @param RolesRequest $request
* @return Response
* @return Response
*/
*/
public
function
store
(
Roles
Request
$request
)
public
function
store
(
UpdateRole
Request
$request
)
{
{
$data
=
$this
->
mergeRequestWithPermissions
(
$request
);
$data
=
$this
->
mergeRequestWithPermissions
(
$request
);
...
@@ -77,12 +76,11 @@ class RolesController extends BaseUserModuleController
...
@@ -77,12 +76,11 @@ class RolesController extends BaseUserModuleController
/**
/**
* Update the specified resource in storage.
* Update the specified resource in storage.
*
* @param int $id
* @param int $id
* @param
Roles
Request $request
* @param
UpdateRole
Request $request
* @return Response
* @return Response
*/
*/
public
function
update
(
$id
,
Roles
Request
$request
)
public
function
update
(
$id
,
UpdateRole
Request
$request
)
{
{
$data
=
$this
->
mergeRequestWithPermissions
(
$request
);
$data
=
$this
->
mergeRequestWithPermissions
(
$request
);
...
...
Modules/User/Http/Requests/
Roles
Request.php
→
Modules/User/Http/Requests/
CreateRole
Request.php
View file @
b6ce3745
...
@@ -4,15 +4,13 @@ namespace Modules\User\Http\Requests;
...
@@ -4,15 +4,13 @@ namespace Modules\User\Http\Requests;
use
Illuminate\Foundation\Http\FormRequest
;
use
Illuminate\Foundation\Http\FormRequest
;
class
Roles
Request
extends
FormRequest
class
CreateRole
Request
extends
FormRequest
{
{
public
function
rules
()
public
function
rules
()
{
{
$roleID
=
$this
->
route
(
'roles'
);
return
[
return
[
'name'
=>
'required'
,
'name'
=>
'required'
,
'slug'
=>
'required|unique:roles,slug
,'
.
$roleID
.
',id
'
,
'slug'
=>
'required|unique:roles,slug'
,
];
];
}
}
...
...
Modules/User/Http/Requests/UpdateRoleRequest.php
0 → 100644
View file @
b6ce3745
<?php
namespace
Modules\User\Http\Requests
;
use
Illuminate\Foundation\Http\FormRequest
;
class
UpdateRoleRequest
extends
FormRequest
{
public
function
rules
()
{
$role
=
$this
->
route
(
'role'
);
return
[
'name'
=>
'required'
,
'slug'
=>
'required|unique:roles,slug,'
.
$role
->
id
.
',id'
,
];
}
public
function
authorize
()
{
return
true
;
}
public
function
messages
()
{
return
[];
}
}
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