Example #1
0
 public function postUpdate(User $user)
 {
     if ($user->id == 1) {
         return $this->redirector->route("user.index");
     }
     $inputs = $this->request->only('email', 'password', 'first_name', 'last_name', 'permissions', 'groups');
     $rules = array('email' => array('email'), 'first_name' => array('required', 'alpha'), 'last_name' => array('required', 'alpha'), 'permissions' => array('array'), 'groups' => array('array'));
     $validator = $this->validator->make($inputs, $rules);
     if ($validator->fails()) {
         return $this->redirector->route('user.update', [$user->id])->withErrors($validator)->withInput($inputs);
     }
     $user->updateme($this->request->all());
     if (strlen($inputs['password']) >= 6) {
         $user->password = $this->hasher->make($inputs["password"]);
         $user->save();
     }
     return $this->redirector->route('user.index');
 }