Beispiel #1
0
 public function passwordUpdate(Request $request)
 {
     $validationRules = AuthController::validationData($this->user->id);
     unset($validationRules['name']);
     unset($validationRules['email']);
     unset($validationRules['gender']);
     $validator = Validator::make($request->all(), $validationRules);
     $validator->after(function ($validator) use($request) {
         if (!Hash::check($request->current, $this->user->password)) {
             $validator->errors()->add('current', 'Your current password is incorrect');
         }
     });
     if ($validator->fails()) {
         return redirect()->back()->withErrors($validator)->withInput();
     }
     $dataRequest = $request->all();
     $dataRequest['name'] = '';
     $dataRequest['email'] = '';
     $dataRequest['gender'] = '';
     $data = AuthController::userData($dataRequest);
     unset($data['name']);
     unset($data['email']);
     unset($data['gender']);
     User::where('id', $this->user->id)->update($data);
     fmsgs(['title' => 'Password Updated', 'type' => 'success', 'text' => "Successfully updating your password"]);
     return redirect('profile');
 }
Beispiel #2
0
 public function userCreate(Request $request)
 {
     $this->validate($request, AuthController::validationData());
     $data = AuthController::userData($request->all());
     // dd($data);
     User::create($data);
     fmsgs(['title' => 'User Created', 'type' => 'success', 'text' => "Successfully adding new user, check the list!"]);
     return redirect()->back();
 }
Beispiel #3
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 public function create(array $data)
 {
     $user = User::create(AuthController::userData($data));
     return $user;
 }