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
21655760
Commit
21655760
authored
Dec 23, 2017
by
Vipul Basapati
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/viralsolani/laravel-adminpanel
into develop
parents
056e545f
b0495043
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
43 additions
and
21 deletions
+43
-21
StoreRoleRequest.php
app/Http/Requests/Backend/Access/Role/StoreRoleRequest.php
+2
-1
UpdateRoleRequest.php
app/Http/Requests/Backend/Access/Role/UpdateRoleRequest.php
+2
-1
StoreUserRequest.php
app/Http/Requests/Backend/Access/User/StoreUserRequest.php
+7
-4
UpdateUserRequest.php
app/Http/Requests/Backend/Access/User/UpdateUserRequest.php
+6
-3
PermissionRepository.php
...tories/Backend/Access/Permission/PermissionRepository.php
+2
-2
RoleRepository.php
app/Repositories/Backend/Access/Role/RoleRepository.php
+1
-1
UserRepository.php
app/Repositories/Backend/Access/User/UserRepository.php
+15
-2
edit.blade.php
resources/views/backend/access/users/edit.blade.php
+8
-7
No files found.
app/Http/Requests/Backend/Access/Role/StoreRoleRequest.php
View file @
21655760
...
...
@@ -27,7 +27,8 @@ class StoreRoleRequest extends Request
public
function
rules
()
{
return
[
'name'
=>
'required|max:191'
,
'name'
=>
'required|max:191'
,
'permissions'
=>
'required'
,
];
}
}
app/Http/Requests/Backend/Access/Role/UpdateRoleRequest.php
View file @
21655760
...
...
@@ -27,7 +27,8 @@ class UpdateRoleRequest extends Request
public
function
rules
()
{
return
[
'name'
=>
'required|max:191'
,
'name'
=>
'required|max:191'
,
'permissions'
=>
'required'
,
];
}
}
app/Http/Requests/Backend/Access/User/StoreUserRequest.php
View file @
21655760
...
...
@@ -28,10 +28,12 @@ class StoreUserRequest extends Request
public
function
rules
()
{
return
[
'first_name'
=>
'required|max:255'
,
'last_name'
=>
'required|max:255'
,
'email'
=>
[
'required'
,
'email'
,
'max:255'
,
Rule
::
unique
(
'users'
)],
'password'
=>
'required|min:6|confirmed'
,
'first_name'
=>
'required|max:255'
,
'last_name'
=>
'required|max:255'
,
'email'
=>
[
'required'
,
'email'
,
'max:255'
,
Rule
::
unique
(
'users'
)],
'password'
=>
'required|min:6|confirmed'
,
'assignees_roles'
=>
'required'
,
'permissions'
=>
'required'
,
];
}
...
...
@@ -43,6 +45,7 @@ class StoreUserRequest extends Request
public
function
messages
()
{
return
[
'assignees_roles'
=>
'Please Select Role'
,
];
}
}
app/Http/Requests/Backend/Access/User/UpdateUserRequest.php
View file @
21655760
...
...
@@ -27,9 +27,11 @@ class UpdateUserRequest extends Request
public
function
rules
()
{
return
[
'email'
=>
'required|email'
,
'first_name'
=>
'required'
,
'last_name'
=>
'required'
,
'email'
=>
'required|email'
,
'first_name'
=>
'required'
,
'last_name'
=>
'required'
,
'permissions'
=>
'required'
,
'assignees_roles'
=>
'required'
,
];
}
...
...
@@ -41,6 +43,7 @@ class UpdateUserRequest extends Request
public
function
messages
()
{
return
[
'assignees_roles'
=>
'Please Select Role'
,
];
}
}
app/Repositories/Backend/Access/Permission/PermissionRepository.php
View file @
21655760
...
...
@@ -74,7 +74,7 @@ class PermissionRepository extends BaseRepository
*
* @return bool
*/
public
function
update
(
Model
$permission
,
array
$input
)
public
function
update
(
$permission
,
array
$input
)
{
if
(
$this
->
query
()
->
where
(
'name'
,
$input
[
'name'
])
->
where
(
'id'
,
'!='
,
$permission
->
id
)
->
first
())
{
throw
new
GeneralException
(
trans
(
'exceptions.backend.access.permissions.already_exists'
));
...
...
@@ -104,7 +104,7 @@ class PermissionRepository extends BaseRepository
*
* @return bool
*/
public
function
delete
(
Model
$permission
)
public
function
delete
(
$permission
)
{
DB
::
transaction
(
function
()
use
(
$permission
)
{
if
(
$permission
->
delete
())
{
...
...
app/Repositories/Backend/Access/Role/RoleRepository.php
View file @
21655760
...
...
@@ -127,7 +127,7 @@ class RoleRepository extends BaseRepository
*
* @return bool
*/
public
function
update
(
Model
$role
,
array
$input
)
public
function
update
(
$role
,
array
$input
)
{
//See if the role has all access, administrator always has all access
if
(
$role
->
id
==
1
)
{
...
...
app/Repositories/Backend/Access/User/UserRepository.php
View file @
21655760
...
...
@@ -12,6 +12,7 @@ use App\Events\Backend\Access\User\UserRestored;
use
App\Events\Backend\Access\User\UserUpdated
;
use
App\Exceptions\GeneralException
;
use
App\Models\Access\User\User
;
use
App\Notifications\Frontend\Auth\UserNeedsConfirmation
;
use
App\Repositories\Backend\Access\Role\RoleRepository
;
use
App\Repositories\BaseRepository
;
use
Illuminate\Support\Facades\DB
;
...
...
@@ -119,6 +120,18 @@ class UserRepository extends BaseRepository
event
(
new
UserCreated
(
$user
));
/*if (isset($data['confirmation_email']) && $user->confirmed == 0) {
$email_type = 1;
}*/
// Send email to the user
/* $options = [
'data' => $user->toArray(),
'email_template_type' => $email_type,
];*/
//createNotification('', 1, 2, $options);
return
true
;
}
...
...
@@ -339,8 +352,8 @@ class UserRepository extends BaseRepository
*/
protected
function
flushPermissions
(
$permissions
,
$user
)
{
//Flush
roles
out, then add array of new ones
$user
->
detachPermissions
(
$user
->
role
s
);
//Flush
permission
out, then add array of new ones
$user
->
detachPermissions
(
$user
->
permission
s
);
$user
->
attachPermissions
(
$permissions
);
}
...
...
resources/views/backend/access/users/edit.blade.php
View file @
21655760
...
...
@@ -102,9 +102,9 @@
{{ trans('labels.backend.access.users.all_permissions') }}
@else
@if (count(
$role->permissions
) > 0)
<blockquote class="
small
">
{{--
--}}@foreach (
$role->permissions
as
$perm
){{--
--}}
{
{$perm->display_name}
}
<blockquote class="
small
">
@foreach (
$role->permissions
as
$perm
)
{
{$perm->display_name}
}
@endforeach
</blockquote>
@else
...
...
@@ -127,13 +127,14 @@
<div class="
row
">
<div class="
col
-
xs
-
12
get
-
available
-
permissions
">
@if (
$permissions
)
@foreach (
$permissions
as
$id
=>
$display_name
)
<div class="
control
-
group
">
<label class="
control
control
--
checkbox
" for="
perm_
{{
$id
}}
">
<input type="
checkbox
" name="
permissions
[{{
$id
}}]
" value="
{{
$id
}}
" id="
perm_
{{
$id
}}
" {{ isset(
$userPermissions[$id]
) && in_array(
$id
,
$userPermissions
) ? 'checked' : '' }} /> <label for="
perm_
{{
$id
}}
">{{
$display_name
}}</label>
<div class="
control__indicator
"></div>
<label class="
control
control
--
checkbox
" for="
perm_
{{
$id
}}
">
<input type="
checkbox
" name="
permissions
[{{
$id
}}]
" value="
{{
$id
}}
" id="
perm_
{{
$id
}}
" {{ isset(
$userPermissions
) && in_array(
$id
,
$userPermissions
) ? 'checked' : '' }} /> <label for="
perm_
{{
$id
}}
">{{
$display_name
}}</label>
<div class="
control__indicator
"></div>
</label>
</div>
</div>
@endforeach
@else
<p>There are no available permissions.</p>
...
...
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