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
Show 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
...
@@ -28,6 +28,7 @@ class StoreRoleRequest extends Request
...
@@ -28,6 +28,7 @@ class StoreRoleRequest extends Request
{
{
return
[
return
[
'name'
=>
'required|max:191'
,
'name'
=>
'required|max:191'
,
'permissions'
=>
'required'
,
];
];
}
}
}
}
app/Http/Requests/Backend/Access/Role/UpdateRoleRequest.php
View file @
21655760
...
@@ -28,6 +28,7 @@ class UpdateRoleRequest extends Request
...
@@ -28,6 +28,7 @@ class UpdateRoleRequest extends Request
{
{
return
[
return
[
'name'
=>
'required|max:191'
,
'name'
=>
'required|max:191'
,
'permissions'
=>
'required'
,
];
];
}
}
}
}
app/Http/Requests/Backend/Access/User/StoreUserRequest.php
View file @
21655760
...
@@ -32,6 +32,8 @@ class StoreUserRequest extends Request
...
@@ -32,6 +32,8 @@ class StoreUserRequest extends Request
'last_name'
=>
'required|max:255'
,
'last_name'
=>
'required|max:255'
,
'email'
=>
[
'required'
,
'email'
,
'max:255'
,
Rule
::
unique
(
'users'
)],
'email'
=>
[
'required'
,
'email'
,
'max:255'
,
Rule
::
unique
(
'users'
)],
'password'
=>
'required|min:6|confirmed'
,
'password'
=>
'required|min:6|confirmed'
,
'assignees_roles'
=>
'required'
,
'permissions'
=>
'required'
,
];
];
}
}
...
@@ -43,6 +45,7 @@ class StoreUserRequest extends Request
...
@@ -43,6 +45,7 @@ class StoreUserRequest extends Request
public
function
messages
()
public
function
messages
()
{
{
return
[
return
[
'assignees_roles'
=>
'Please Select Role'
,
];
];
}
}
}
}
app/Http/Requests/Backend/Access/User/UpdateUserRequest.php
View file @
21655760
...
@@ -30,6 +30,8 @@ class UpdateUserRequest extends Request
...
@@ -30,6 +30,8 @@ class UpdateUserRequest extends Request
'email'
=>
'required|email'
,
'email'
=>
'required|email'
,
'first_name'
=>
'required'
,
'first_name'
=>
'required'
,
'last_name'
=>
'required'
,
'last_name'
=>
'required'
,
'permissions'
=>
'required'
,
'assignees_roles'
=>
'required'
,
];
];
}
}
...
@@ -41,6 +43,7 @@ class UpdateUserRequest extends Request
...
@@ -41,6 +43,7 @@ class UpdateUserRequest extends Request
public
function
messages
()
public
function
messages
()
{
{
return
[
return
[
'assignees_roles'
=>
'Please Select Role'
,
];
];
}
}
}
}
app/Repositories/Backend/Access/Permission/PermissionRepository.php
View file @
21655760
...
@@ -74,7 +74,7 @@ class PermissionRepository extends BaseRepository
...
@@ -74,7 +74,7 @@ class PermissionRepository extends BaseRepository
*
*
* @return bool
* @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
())
{
if
(
$this
->
query
()
->
where
(
'name'
,
$input
[
'name'
])
->
where
(
'id'
,
'!='
,
$permission
->
id
)
->
first
())
{
throw
new
GeneralException
(
trans
(
'exceptions.backend.access.permissions.already_exists'
));
throw
new
GeneralException
(
trans
(
'exceptions.backend.access.permissions.already_exists'
));
...
@@ -104,7 +104,7 @@ class PermissionRepository extends BaseRepository
...
@@ -104,7 +104,7 @@ class PermissionRepository extends BaseRepository
*
*
* @return bool
* @return bool
*/
*/
public
function
delete
(
Model
$permission
)
public
function
delete
(
$permission
)
{
{
DB
::
transaction
(
function
()
use
(
$permission
)
{
DB
::
transaction
(
function
()
use
(
$permission
)
{
if
(
$permission
->
delete
())
{
if
(
$permission
->
delete
())
{
...
...
app/Repositories/Backend/Access/Role/RoleRepository.php
View file @
21655760
...
@@ -127,7 +127,7 @@ class RoleRepository extends BaseRepository
...
@@ -127,7 +127,7 @@ class RoleRepository extends BaseRepository
*
*
* @return bool
* @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
//See if the role has all access, administrator always has all access
if
(
$role
->
id
==
1
)
{
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;
...
@@ -12,6 +12,7 @@ use App\Events\Backend\Access\User\UserRestored;
use
App\Events\Backend\Access\User\UserUpdated
;
use
App\Events\Backend\Access\User\UserUpdated
;
use
App\Exceptions\GeneralException
;
use
App\Exceptions\GeneralException
;
use
App\Models\Access\User\User
;
use
App\Models\Access\User\User
;
use
App\Notifications\Frontend\Auth\UserNeedsConfirmation
;
use
App\Repositories\Backend\Access\Role\RoleRepository
;
use
App\Repositories\Backend\Access\Role\RoleRepository
;
use
App\Repositories\BaseRepository
;
use
App\Repositories\BaseRepository
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\DB
;
...
@@ -119,6 +120,18 @@ class UserRepository extends BaseRepository
...
@@ -119,6 +120,18 @@ class UserRepository extends BaseRepository
event
(
new
UserCreated
(
$user
));
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
;
return
true
;
}
}
...
@@ -339,8 +352,8 @@ class UserRepository extends BaseRepository
...
@@ -339,8 +352,8 @@ class UserRepository extends BaseRepository
*/
*/
protected
function
flushPermissions
(
$permissions
,
$user
)
protected
function
flushPermissions
(
$permissions
,
$user
)
{
{
//Flush
roles
out, then add array of new ones
//Flush
permission
out, then add array of new ones
$user
->
detachPermissions
(
$user
->
role
s
);
$user
->
detachPermissions
(
$user
->
permission
s
);
$user
->
attachPermissions
(
$permissions
);
$user
->
attachPermissions
(
$permissions
);
}
}
...
...
resources/views/backend/access/users/edit.blade.php
View file @
21655760
...
@@ -102,9 +102,9 @@
...
@@ -102,9 +102,9 @@
{{ trans('labels.backend.access.users.all_permissions') }}
{{ trans('labels.backend.access.users.all_permissions') }}
@else
@else
@if (count(
$role->permissions
) > 0)
@if (count(
$role->permissions
) > 0)
<blockquote class="
small
">
{{--
<blockquote class="
small
">
--}}@foreach (
$role->permissions
as
$perm
){{--
@foreach (
$role->permissions
as
$perm
)
--}}
{
{$perm->display_name}
}
{
{$perm->display_name}
}
@endforeach
@endforeach
</blockquote>
</blockquote>
@else
@else
...
@@ -127,10 +127,11 @@
...
@@ -127,10 +127,11 @@
<div class="
row
">
<div class="
row
">
<div class="
col
-
xs
-
12
get
-
available
-
permissions
">
<div class="
col
-
xs
-
12
get
-
available
-
permissions
">
@if (
$permissions
)
@if (
$permissions
)
@foreach (
$permissions
as
$id
=>
$display_name
)
@foreach (
$permissions
as
$id
=>
$display_name
)
<div class="
control
-
group
">
<div class="
control
-
group
">
<label class="
control
control
--
checkbox
" for="
perm_
{{
$id
}}
">
<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>
<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>
<div class="
control__indicator
"></div>
</label>
</label>
</div>
</div>
...
...
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