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"){ $teacher =User::find($req->id); $teacher->status =$req->status; $teacher->update(); // $data['name'] = $teacher->first_name.' '.$teacher->last_name; // $user_mail = $teacher->email; // $from = 'test@mail.com'; // Mail::send('email.send_apply_student_teacher_email',$data, function ($message) use ($user_mail,$from) { // $message->from($from); // $message->to($user_mail)->subject('New Email Send to you'); // }); return response( ['msg'=>'Your login permission successfully updated.'] ); } } }