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
168b450e
Commit
168b450e
authored
Mar 13, 2018
by
cygnet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes done to pass the error to validation function as string
parent
86afc0bf
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
8 deletions
+8
-8
APIController.php
app/Http/Controllers/Api/V1/APIController.php
+2
-2
PermissionController.php
app/Http/Controllers/Api/V1/PermissionController.php
+2
-2
RolesController.php
app/Http/Controllers/Api/V1/RolesController.php
+2
-2
UsersController.php
app/Http/Controllers/Api/V1/UsersController.php
+2
-2
No files found.
app/Http/Controllers/Api/V1/APIController.php
View file @
168b450e
...
...
@@ -198,8 +198,8 @@ class APIController extends Controller
*
* @return mix
*/
public
function
throwValidation
(
$
validation
)
public
function
throwValidation
(
$
message
)
{
return
[
'error'
=>
$validation
->
errors
()
];
return
[
'error'
=>
$message
];
}
}
app/Http/Controllers/Api/V1/PermissionController.php
View file @
168b450e
...
...
@@ -62,7 +62,7 @@ class PermissionController extends APIController
{
$validation
=
$this
->
validatePermission
(
$request
);
if
(
$validation
->
fails
())
{
return
$this
->
throwValidation
(
$validation
);
return
$this
->
throwValidation
(
$validation
->
messages
()
->
first
()
);
}
$this
->
repository
->
create
(
$request
->
all
());
...
...
@@ -82,7 +82,7 @@ class PermissionController extends APIController
$validation
=
$this
->
validatePermission
(
$request
,
$permission
->
id
);
if
(
$validation
->
fails
())
{
return
$this
->
throwValidation
(
$validation
);
return
$this
->
throwValidation
(
$validation
->
messages
()
->
first
()
);
}
$this
->
repository
->
update
(
$permission
,
$request
->
all
());
...
...
app/Http/Controllers/Api/V1/RolesController.php
View file @
168b450e
...
...
@@ -61,7 +61,7 @@ class RolesController extends APIController
{
$validation
=
$this
->
validateRole
(
$request
);
if
(
$validation
->
fails
())
{
return
$this
->
throwValidation
(
$validation
);
return
$this
->
throwValidation
(
$validation
->
messages
()
->
first
()
);
}
$this
->
repository
->
create
(
$request
->
all
());
...
...
@@ -82,7 +82,7 @@ class RolesController extends APIController
$validation
=
$this
->
validateRole
(
$request
);
if
(
$validation
->
fails
())
{
return
$this
->
throwValidation
(
$validation
);
return
$this
->
throwValidation
(
$validation
->
messages
()
->
first
()
);
}
$this
->
repository
->
update
(
$role
,
$request
->
all
());
...
...
app/Http/Controllers/Api/V1/UsersController.php
View file @
168b450e
...
...
@@ -62,7 +62,7 @@ class UsersController extends APIController
$validation
=
$this
->
validateUser
(
$request
);
if
(
$validation
->
fails
())
{
return
$this
->
throwValidation
(
$validation
);
return
$this
->
throwValidation
(
$validation
->
messages
()
->
first
()
);
}
$this
->
repository
->
create
(
$request
);
...
...
@@ -83,7 +83,7 @@ class UsersController extends APIController
$validation
=
$this
->
validateUser
(
$request
,
'edit'
,
$user
->
id
);
if
(
$validation
->
fails
())
{
return
$this
->
throwValidation
(
$validation
);
return
$this
->
throwValidation
(
$validation
->
messages
()
->
first
()
);
}
$updatedUser
=
$this
->
repository
->
update
(
$user
,
$request
);
...
...
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