/**
  * Process the edit form
  *
  * @author ZZK
  * @link   http://verecom.com
  *
  * @param $id
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function update($id)
 {
     $inputs = Input::all();
     $inputs['id'] = $id;
     try {
         if ($this->form->update($inputs)) {
             return Redirect::route('admin.permissions.index')->with('success', Lang::get('admin::permissions.update_success'));
         }
         return Redirect::back()->withInput()->withErrors($this->form->getErrors());
     } catch (PermissionNotFoundException $e) {
         return Redirect::route('admin.permissions.index')->with('error', Lang::get('admin::permissions.model_not_found'));
     }
 }
 /**
  * Display the user edit form
  *
  * @author ZZK
  * @link   http://verecom.com
  *
  * @param int $id
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function edit($id)
 {
     try {
         $user = $this->users->findById($id);
         $groups = $this->groups->findAll();
         $userPermissions = $user->getPermissions();
         $genericPermissions = $this->permissions->generic();
         $modulePermissions = $this->permissions->module();
         //get only the group id the user belong to
         $userGroupsId = array_pluck($user->getGroups()->toArray(), 'id');
         return View::make(Config::get('admin::views.users_edit'))->with('user', $user)->with('groups', $groups)->with('userGroupsId', $userGroupsId)->with('genericPermissions', $genericPermissions)->with('modulePermissions', $modulePermissions)->with('userPermissions', $userPermissions);
     } catch (UserNotFoundException $e) {
         return Redirect::route('admin.users.index')->with('error', $e->getMessage());
     }
 }