public function processVerifyEmail($step) { $StepModel = new Step(); if (request('verify_email')) { $StepModel->where('id', '!=', $step->id)->update(['verify_email' => 0]); $step->verify_email = 1; $step->save(); } }
public function verifyEmail($token, Registration $RegistrationModel) { if (!($registration = $RegistrationModel->whereVerificationToken($token)->with('files')->first())) { return 'رابط التفعيل الذي استخدمته اصبح غير صالح للاستعمال، قم بارسال طلب تفعيل جديد من بوابتك'; } if ($registration->email_verified) { return redirect()->to(env('REGSITRAR_EMAIL_EMAIL_VERIFIED_REDIRECT', 'https://el-css.edu.om/registrar')); } $registration->load('step'); $extra = ['comment' => 'يرجى تحميل ملفاتك']; $nextStep = $registration->step->children()->where('upload_files', 1)->first(); if ($registration->files->count()) { $nextStep = RegistrationStep::where('files_processing', 1)->first(); $extra = []; } if ($nextStep && $registration->step->verify_email == 1) { $registration->email_verified = 1; $registration->registration_step_id = $nextStep->id; $registration->save(); event(new RegistrationEmailVerified($registration)); // event(new RegistrationUpdated($registration)); event(new RegistrationStepChanged($registration, $extra)); } return redirect()->to(env('REGSITRAR_EMAIL_EMAIL_VERIFIED_REDIRECT', 'https://el-css.edu.om/registrar')); }