public function edit(Request $request, $userId)
 {
     $adminUser = AdminUser::find($userId);
     if (!$adminUser) {
         abort(404);
     }
     $roles = Role::all();
     return view('lara-mvcms::administration.admin-users.edit')->with('adminUser', $adminUser)->with('roles', $roles);
 }
Example #2
0
 public function hasPermission($permission)
 {
     $rolesHasPermission = Role::permit($permission)->get();
     $myRoles = $this->roles;
     if ($rolesHasPermission->isEmpty() || $myRoles->isEmpty()) {
         return false;
     }
     $intersect = $rolesHasPermission->intersect($myRoles);
     return count($intersect) == 0 ? false : true;
 }
Example #3
0
 public function destroy(Request $request, $roleId)
 {
     $role = Role::find($roleId);
     if (!$role) {
         abort(404);
     }
     $role->delete();
     $request->session()->flash('success', trans('lara-mvcms::roles.delete-success'));
     return redirect()->route('lara-mvcms.administration.roles.index');
 }
Example #4
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $role = Role::create(['name' => 'administrator', 'gb' => ['title' => 'Administrator', 'description' => 'Can use administration menu']]);
     $role->addPermissionByName('manage-permissions');
     $role->addPermissionByName('manage-roles');
     $role->addPermissionByName('manage-admin-users');
     $role->addPermissionByName('manage-pages');
     $role->addPermissionByName('manage-entries');
     $role->addPermissionByName('manage-galleries');
     /*$role->addPermissionByName('manage-categories');
       $role->addPermissionByName('manage-tags');
       $role->addPermissionByName('manage-posts');*/
 }