/**
  * Update the password
  *
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  * @throws \Illuminate\Foundation\Validation\ValidationException
  */
 public function updatePassword(Request $request)
 {
     // Validate the password length
     $validator = $this->validator($request->all());
     if ($validator->fails()) {
         $this->throwValidationException($request, $validator);
     }
     // Get the currently logged chiefWardenStaff
     $chiefWardenStaff = ChiefWardenStaff::find(Auth::guard('chiefWardenStaff')->user()->id);
     $newPassword = $request['password'];
     $chiefWardenStaff->password = bcrypt($newPassword);
     $chiefWardenStaff->firstLogin = false;
     $chiefWardenStaff->save();
     return redirect('/chiefWardenStaffs/home');
 }
 /**
  * Update user password
  *
  * @param Request $request
  * @return mixed
  */
 public function updatePassword(Request $request)
 {
     // Get the logged in user
     $chiefWardenStaff = ChiefWardenStaff::find(Auth::guard('chiefWardenStaff')->user()->id);
     $newPassword = $request['password'];
     // Validate the password
     $this->validate($request, ['password' => 'required|min:8']);
     // Save updated password
     $chiefWardenStaff->password = bcrypt($newPassword);
     $chiefWardenStaff->save();
     return redirect()->back()->with('status', 'Success');
 }
 /**
  * Create a new ChiefWardenStaff instance after a valid registration.
  *
  * @param  array  $data
  * @return ChiefWardenStaff
  */
 protected function create(array $data)
 {
     return ChiefWardenStaff::create(['id' => $data['id'], 'name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password']), 'firstLogin' => true]);
 }
 /**
  * Remove an chiefWardenStaff
  *
  * @param $id
  * @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse
  */
 public function removeChiefWardenStaff($id)
 {
     if ($id != null) {
         ChiefWardenStaff::destroy($id);
     }
     return redirect('admins/manage/chiefWardenStaffs');
 }