all(), [ 'old_password'=>'required', 'new_password_confirmation'=>'required', 'new_password'=>[ 'required', 'confirmed', 'min:8', //'regex:/[a-z]/', //'regex:/[A-Z]/', //'regex:/[0-9]/', //'regex:/[@$!%*#?&]/', ] ]); // [ // 'regex' => 'The :attribute must contain at least one lowercase, uppercase, digit and special character.' // ]); if($validator->fails()){ $errors=$validator->errors()->all(); return response(['msg'=>$errors[0]], 422); } $user=auth_user('teacher'); if(\Illuminate\Support\Facades\Hash::check($req->old_password, $user->password)) { $user->password=bcrypt($req->new_password); $user->update(); return ['msg'=>'Your login password updated successfully!. Please use your new password for next time login.']; }else{ return response( ['msg'=>'Sorry!, old password does not match with login credential.'], 403 ); } }elseif($name=="teacher_user_status_change"){ $data =User::find($req->id); $data->status =$req->status; $data->update(); return response( ['msg'=>'Status successfully changed.'] ); } } }