Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PHP
laravel-rbac
Commits
e637f593
Commit
e637f593
authored
5 years ago
by
康帅杰
Browse files
Options
Download
Email Patches
Plain Diff
add menu sort
parent
bc3aba7b
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Models/User.php
+4
-1
src/Models/User.php
with
4 additions
and
1 deletion
+4
-1
src/Models/User.php
View file @
e637f593
...
...
@@ -27,6 +27,9 @@ class User extends Model
foreach
(
$this
->
roles
as
$role
){
$re
=
array_merge
(
$re
,
$role
->
side_menu
);
}
return
collect
(
$re
)
->
unique
(
'id'
)
->
toArray
();
// $re = collect($re)->unique('id');
// $re = $re->sortBy('id');
// return $re->values()->all();
return
collect
(
$re
)
->
unique
(
'id'
)
->
sortBy
(
'id'
)
->
values
()
->
all
();
}
}
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help