Commit 21655760 authored by Vipul Basapati's avatar Vipul Basapati

Merge branch 'master' of https://github.com/viralsolani/laravel-adminpanel into develop

parents 056e545f b0495043
......@@ -27,7 +27,8 @@ class StoreRoleRequest extends Request
public function rules()
{
return [
'name' => 'required|max:191',
'name' => 'required|max:191',
'permissions' => 'required',
];
}
}
......@@ -27,7 +27,8 @@ class UpdateRoleRequest extends Request
public function rules()
{
return [
'name' => 'required|max:191',
'name' => 'required|max:191',
'permissions' => 'required',
];
}
}
......@@ -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',
];
}
}
......@@ -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',
];
}
}
......@@ -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()) {
......
......@@ -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) {
......
......@@ -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->roles);
//Flush permission out, then add array of new ones
$user->detachPermissions($user->permissions);
$user->attachPermissions($permissions);
}
......
......@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment