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
9a527ae4
Commit
9a527ae4
authored
Jul 04, 2018
by
Viral Solani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API changes in user , role and permission
parent
89a4ef1f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
8 deletions
+15
-8
PermissionController.php
app/Http/Controllers/Api/V1/PermissionController.php
+4
-2
RolesController.php
app/Http/Controllers/Api/V1/RolesController.php
+5
-2
UsersController.php
app/Http/Controllers/Api/V1/UsersController.php
+4
-2
UserResource.php
app/Http/Resources/UserResource.php
+2
-2
No files found.
app/Http/Controllers/Api/V1/PermissionController.php
View file @
9a527ae4
...
...
@@ -31,10 +31,12 @@ class PermissionController extends APIController
*/
public
function
index
(
Request
$request
)
{
$limit
=
$request
->
get
(
'paginate'
)
?
$request
->
get
(
'paginate'
)
:
25
;
$limit
=
$request
->
get
(
'paginate'
)
?
$request
->
get
(
'paginate'
)
:
25
;
$orderBy
=
$request
->
get
(
'orderBy'
)
?
$request
->
get
(
'orderBy'
)
:
'ASC'
;
$sortBy
=
$request
->
get
(
'sortBy'
)
?
$request
->
get
(
'sortBy'
)
:
'created_at'
;
return
PermissionResource
::
collection
(
$this
->
repository
->
getForDataTable
()
->
paginate
(
$limit
)
$this
->
repository
->
getForDataTable
()
->
orderBy
(
$sortBy
,
$orderBy
)
->
paginate
(
$limit
)
);
}
...
...
app/Http/Controllers/Api/V1/RolesController.php
View file @
9a527ae4
...
...
@@ -31,10 +31,12 @@ class RolesController extends APIController
*/
public
function
index
(
Request
$request
)
{
$limit
=
$request
->
get
(
'paginate'
)
?
$request
->
get
(
'paginate'
)
:
25
;
$limit
=
$request
->
get
(
'paginate'
)
?
$request
->
get
(
'paginate'
)
:
25
;
$orderBy
=
$request
->
get
(
'orderBy'
)
?
$request
->
get
(
'orderBy'
)
:
'ASC'
;
$sortBy
=
$request
->
get
(
'sortBy'
)
?
$request
->
get
(
'sortBy'
)
:
'created_at'
;
return
RoleResource
::
collection
(
$this
->
repository
->
getForDataTable
()
->
paginate
(
$limit
)
$this
->
repository
->
getForDataTable
()
->
orderBy
(
$sortBy
,
$orderBy
)
->
paginate
(
$limit
)
);
}
...
...
@@ -60,6 +62,7 @@ class RolesController extends APIController
public
function
store
(
Request
$request
)
{
$validation
=
$this
->
validateRole
(
$request
);
if
(
$validation
->
fails
())
{
return
$this
->
throwValidation
(
$validation
->
messages
()
->
first
());
}
...
...
app/Http/Controllers/Api/V1/UsersController.php
View file @
9a527ae4
...
...
@@ -31,10 +31,12 @@ class UsersController extends APIController
*/
public
function
index
(
Request
$request
)
{
$limit
=
$request
->
get
(
'paginate'
)
?
$request
->
get
(
'paginate'
)
:
25
;
$limit
=
$request
->
get
(
'paginate'
)
?
$request
->
get
(
'paginate'
)
:
25
;
$orderBy
=
$request
->
get
(
'orderBy'
)
?
$request
->
get
(
'orderBy'
)
:
'ASC'
;
$sortBy
=
$request
->
get
(
'sortBy'
)
?
$request
->
get
(
'sortBy'
)
:
'created_at'
;
return
UserResource
::
collection
(
$this
->
repository
->
getForDataTable
(
1
,
false
)
->
paginate
(
$limit
)
$this
->
repository
->
getForDataTable
(
1
,
false
)
->
orderBy
(
$sortBy
,
$orderBy
)
->
paginate
(
$limit
)
);
}
...
...
app/Http/Resources/UserResource.php
View file @
9a527ae4
...
...
@@ -25,8 +25,8 @@ class UserResource extends Resource
'role'
=>
optional
(
$this
->
roles
()
->
first
())
->
name
,
'permissions'
=>
$this
->
permissions
()
->
get
(),
'status'
=>
$this
->
status
,
'
registered_at'
=>
$this
->
created_at
->
toIso8601String
(),
'
last_updated_at'
=>
$this
->
updated_at
->
toIso8601String
(),
'
created_at'
=>
$this
->
created_at
->
toIso8601String
(),
'
updated_at'
=>
$this
->
updated_at
->
toIso8601String
(),
];
}
}
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