public function verifyEmail($token, Registration $RegistrationModel) { if (!($registration = $RegistrationModel->whereVerificationToken($token)->first())) { return redirect()->route('welcome'); } if ($registration->email_verified) { return redirect()->route('registration.registrar.index')->with('success', trans('registration::registrar.already_verified_email')); } $nextStep = $registration->step->children()->first(); $registration->email_verified = 1; $registration->registration_step_id = $nextStep->id; $registration->save(); // event(new RegistrationUpdated($registration)); event(new RegistrationStepChanged($registration, ['comment' => 'يرجى تحميل ملفاتك'])); return redirect()->route('registration.registrar.index')->with('success', trans('registration::registrar.email_verified', ['name' => $registration->fullname])); }
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')); }