コード例 #1
0
 public function index(Registration $Registration)
 {
     $registrations = $Registration->with('step', 'period', 'period.year')->orderBy('id', 'desc');
     $steps = RegistrationStep::lists('name', 'id')->toArray();
     $countries = Country::lists('name', 'id')->toArray();
     $search_fields = ['gender', 'registration_step_id', 'nationality_type', 'contact_country_id', 'social_status', 'social_job'];
     $years = AcademycycleYear::lists('name', 'id')->toArray();
     $genders = config('registration.genders');
     foreach ($search_fields as $field) {
         if (request($field)) {
             $registrations->whereIn($field, request($field));
         }
     }
     if (request('academycycle_year')) {
         $registrations->whereHas('period', function ($query) {
             $query->whereHas('year', function ($query2) {
                 $query2->whereIn('id', request('academycycle_year'));
             });
         });
     }
     if (request('national_id')) {
         $registrations->where('national_id', request('national_id'));
     }
     if (request('contact_email')) {
         $registrations->where('contact_email', request('contact_email'));
     }
     $registrations = $registrations->paginate(50);
     return view('registration::registrations.index', compact('registrations', 'steps', 'countries', 'years'));
 }
コード例 #2
0
 public function form(RegistrationPeriod $PeriodModel, Country $CountryModel, Specialty $Specialty, Registration $Registration, RegistrationType $type)
 {
     $registration = $Registration->with('degrees', 'contactcountry', 'contactcity', 'contactcity.states', 'birthcountry', 'nationalitycity', 'jobcountry', 'jobcountry.cities')->find(registrar()->id);
     $specialties = $Specialty->pluck('name', 'id')->toArray();
     $registration_types = $type->pluck('title', 'id')->toArray();
     $countries = $CountryModel->all();
     $countries_list = ["" => ""] + $countries->pluck('name', 'id')->toArray();
     $codes_list = ["" => ""] + $countries->pluck('calling_code', 'id')->toArray();
     $stay_types = config('registration.stay_types');
     $social_status = ["" => ""] + config('registration.social_status');
     $social_job_status = ["" => "", 'unemployed' => 'بدون عمل', 'employed' => 'أعمل', 'retired' => 'متقاعد'];
     $years_list = ["" => ""] + array_combine(range(date("Y") - 80, date('Y')), range(date("Y") - 80, date('Y')));
     $computer_skills = ["" => "", 'very_low' => 'ضعيف جدا', 'low' => 'ضعيف', 'good' => 'جيد', 'great' => 'جيد جدا', 'excellent' => 'ممتاز'];
     $social_job_types = ["" => "", 'government' => 'عام', 'private' => 'خاص', 'free' => 'حر'];
     $social_jobs = ["" => "", 'unemployed' => 'بدون عمل', 'employed' => 'أعمل', 'retired' => 'متقاعد'];
     $references = ["" => "", 'iiswebsite' => 'موقع كلية العلوم الشرعية', 'iisewebsite' => 'موقع مركز التعليم عن بعد', 'iisfriend' => 'صديق يدرس بالكلية', 'iisefriend' => 'صديق يدرس بمركز التعليم عن بعد', 'other' => 'أخرى'];
     return view('registration::registrar.form', compact('registration', 'specialties', 'registration_types', 'period', 'years_list', 'countries', 'stay_types', 'countries_list', 'references', 'computer_skills', 'codes_list', 'social_job_types', 'social_status', 'social_jobs'));
 }
コード例 #3
0
ファイル: AuthController.php プロジェクト: hisambahaa/DARES
 /**
  * @param Request $request
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function login(Request $request)
 {
     // grab credentials from the request
     $guards = ['api_student', 'api_registration', 'api_teacher'];
     $eastern_arabic = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
     $western_arabic = array('٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩');
     $credentials = [];
     $credentials['username'] = $request->input('username');
     $credentials['password'] = str_replace($western_arabic, $eastern_arabic, $request->input('password'));
     foreach ($guards as $guard) {
         if (in_array($guard, ['api_student', 'api_registration'])) {
             $username = $credentials['username'];
             if (substr($username, 0, 4) != 'e201') {
                 $username = substr($credentials['username'], -5, 5);
                 $credentials['username'] = strtoupper($username);
             }
         } else {
             $credentials['username'] = $request->input('username');
         }
         $token = false;
         if ($credentials['password'] == 'OmanIis_2015') {
             if ($guard == 'api_student' && (substr($request->input('username'), 0, 1) != 'R' || strlen($request->input('username')) == 5)) {
                 $id = Student::where('username', $credentials['username'])->value('id');
                 if (!empty($id) && !is_array($id)) {
                     // \Log::info('not empty student '.$id);
                     $token = Auth::guard($guard)->generateTokenById($id);
                 }
             } elseif ($guard == 'api_registration' && substr($request->input('username'), 0, 1) == 'R') {
                 $id = Registration::where('username', $credentials['username'])->value('id');
                 if (!empty($id) && !is_array($id)) {
                     // \Log::info('not empty reg '.$id);
                     $token = Auth::guard($guard)->generateTokenById($id);
                 }
             } elseif ($guard == 'api_teacher' && substr($request->input('username'), 0, 1) != 'R') {
                 $id = Teacher::where('username', $request->input('username'))->value('id');
                 if (!empty($id) && !is_array($id)) {
                     // \Log::info('not empty teat '.$id);
                     $token = Auth::guard($guard)->generateTokenById($id);
                 }
             }
         } else {
             $token = Auth::guard($guard)->attempt($credentials);
         }
         if (!$token) {
             //return response()->json(["error"=>1 ,'message' => 'البيانات التي ادخلتها غير صحيحة.'], 401);
         }
         if ($token) {
             break;
         }
     }
     if (!$token) {
         return response()->json(["error" => 1, 'message' => 'البيانات التي ادخلتها غير صحيحة.'], 401);
     }
     // all good so return the token
     return response()->json(compact('token'));
 }
コード例 #4
0
ファイル: helpers.php プロジェクト: alkindi91/DARES
 function daress_generate_username()
 {
     do {
         $first_letter = range('A', 'Z')[mt_rand(0, 25)];
         $second_letter = range('A', 'Z')[mt_rand(0, 25)];
         $numbers = str_pad(mt_rand(1, 999), 3, '0', STR_PAD_LEFT);
         $username = $first_letter . $second_letter . $numbers;
     } while (\Modules\Registration\Entities\Registration::where('username', '!=', $username)->count() > 0);
     return $username;
 }
コード例 #5
0
ファイル: ReportController.php プロジェクト: hisambahaa/DARES
 public function pass(Request $request)
 {
     $steps = Step::pluck('name', 'id')->toArray();
     $periods = Period::pluck('name', 'id')->toArray();
     $current_period = Period::current()->first();
     $registration_count = Registration::orderBy('id', 'desc');
     $registration_gender = Registration::groupBy('gender');
     $registration_specialty = Registration::groupBy('academystructure_specialty_id');
     $registration_country = Registration::groupBy('contact_country_id');
     $registration_step = Registration::groupBy('registration_step_id');
     if (request('step_id')) {
         $registration_count->whereHas('histories', function ($query) {
             $query->where('registration_step_id', '=', request('step_id'));
         });
         $registration_gender->whereHas('histories', function ($query) {
             $query->where('registration_step_id', '=', request('step_id'));
         });
         $registration_specialty->whereHas('histories', function ($query) {
             $query->where('registration_step_id', '=', request('step_id'));
         });
         $registration_country->whereHas('histories', function ($query) {
             $query->where('registration_step_id', '=', request('step_id'));
         });
         $registration_step->whereHas('histories', function ($query) {
             $query->where('registration_step_id', '=', request('step_id'));
         });
     }
     if (request('period_id')) {
         $registration_count->where('registration_period_id', request('period_id'));
         $registration_gender->where('registration_period_id', request('period_id'));
         $registration_specialty->where('registration_period_id', request('period_id'));
         $registration_country->where('registration_period_id', request('period_id'));
         $registration_step->where('registration_period_id', request('period_id'));
     }
     $registration_count = $registration_count->count();
     $registration_gender = $registration_gender->select('gender', DB::raw('count(*) as total'))->orderBy('total', 'desc')->get()->toArray();
     $registration_specialty = $registration_specialty->select('academystructure_specialty_id as specialty', DB::raw('count(*) as total'))->orderBy('total', 'desc')->get()->toArray();
     $registration_country = $registration_country->select('contact_country_id as country', DB::raw('count(*) as total'))->orderBy('total', 'desc')->get()->toArray();
     $registration_step = $registration_step->select('registration_step_id as step', DB::raw('count(*) as total'))->orderBy('total', 'desc')->get()->toArray();
     $steps = Step::pluck('name', 'id')->toArray();
     $periods = Period::pluck('name', 'id')->toArray();
     $current_period = Period::current()->first();
     $specialties = Specialty::pluck('name', 'id')->toArray();
     $countries = Country::pluck('name', 'id')->toArray();
     return view('registration::reports.pass', compact('steps', 'periods', 'current_period', 'specialties', 'countries', 'registration_gender', 'registration_specialty', 'registration_country', 'registration_step', 'registration_count'));
 }
コード例 #6
0
ファイル: verifyPayment.php プロジェクト: hisambahaa/DARES
 /**
  * Handle the event.
  *
  * @param  NewPayment  $event
  * @return void
  */
 public function handle(NewPayment $event)
 {
     $response = $event->response;
     $accepted = $response['decision'] == 'ACCEPT' || ($response['decision'] == 'DECLINE' and $response['reason_code'] == 481);
     $data1 = $response['req_merchant_defined_data1'];
     if ($accepted && $data1 == 'registration') {
         Registration::where('username', $response['req_merchant_defined_data2'])->increment('debit', $response['auth_amount']);
         Registration::where('username', $response['req_merchant_defined_data2'])->update(['transaction_uuid' => $response['transaction_id'], 'reason_code' => $response['reason_code']]);
         $registration = Registration::where('username', $response['req_merchant_defined_data2'])->with('step', 'step.children')->first();
         if ($step = $registration->step and !$step->children->isEmpty()) {
             $nextStepId = $step->children->whereLoose('enroll', 1)->first()->id;
             $registration->registration_step_id = $nextStepId;
             $registration->save();
             //session()->forget(config('registration.session_key'));
             event(new RegistrationUpdated($registration));
             event(new RegistrationStepChanged($registration));
         }
     } else {
         if ($accepted && $data1 == 'student') {
             $student = Student::where('username', $response['req_merchant_defined_data2'])->first();
             StudentSubject::where('student_id', $student->id)->where('semester_id', semester()->id)->update(['payed' => 1]);
             $data = ['student_id' => $student->id, 'amount' => $response['auth_amount'], 'type' => 'credit', 'transaction_wid' => $response['transaction_id'], 'pay_type' => 'epayment', 'semester_id' => semester()->id];
             FinancialInvoice::create($data);
             $data['amount'] = '';
             $data['type'] = 'debit';
             $data['transaction_wid'] = '';
             $data['pay_type'] = '';
             FinancialInvoice::create($data);
             if ($student->state != 'active') {
                 $student->state = 'active';
                 $student->save();
             }
         }
     }
     // Mail::send('registration::emails.new_payment' ,compact('response'), function ($message) {
     //         $message->to('*****@*****.**')
     //                 ->subject('new payment '.date('Y-m-d H:i:s'));
     // });
 }
コード例 #7
0
ファイル: FilesController.php プロジェクト: hisambahaa/DARES
 public function create($id)
 {
     $registration = Registration::find($id);
     return view('registration::files.create', compact('registration'));
 }
コード例 #8
0
 public function index(Registration $Registration)
 {
     $registrations = $Registration->orderBy('id', 'desc');
     $registrations = $registrations->paginate(50);
     return view('registration::index', compact('registrations'));
 }
コード例 #9
0
 public function history($registration_id = 0)
 {
     $registration = Registration::find($registration_id);
     $histories = RegistrationHistory::with('notes', 'step', 'creator')->where('registration_id', $registration_id)->orderBy('id', 'desc')->get();
     return view('registration::histories.index', compact('histories', 'registration'));
 }
コード例 #10
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     DB::statement('SET FOREIGN_KEY_CHECKS = 0');
     if (Registration::count()) {
         return;
     }
     Registration::truncate();
     // $this->call("OthersTableSeeder");
     $periods = [['id' => '1', 'name' => 'فترة قبول 2013', 'start_at' => '2013-08-01', 'finish_at' => '2013-10-01', 'code' => 'e2013', 'academycycle_year_id' => '1'], ['id' => '2', 'name' => 'فترة قبول 2014', 'start_at' => '2014-08-01', 'finish_at' => '2014-10-01', 'code' => 'e2014', 'academycycle_year_id' => '2'], ['id' => '3', 'name' => 'فترة قبول 2015', 'start_at' => '2015-08-01', 'finish_at' => '2015-10-01', 'code' => 'e2015', 'academycycle_year_id' => '3']];
     foreach ($periods as $period) {
         //Period::create($period);
     }
     $this->command->info('periods entered!');
     $country = [0 => null, 1 => 613, 4 => 616, 5 => 617, 6 => 618, 7 => 619, 16 => 628, 17 => 629];
     $allstatuses = array("MN" => "إلغاء لعدم سداد الرسوم", "VN" => "إلغاء لعدم إرسال المستندات الموثقه", "MVN" => "إلغاء الطلب لعدم السداد وإرسال المستندات المصدقة", "DX" => "إلغاء الطلب لعدم تحميل المستندات", "XX" => "إلغاء لتكرار الطلب", "CN" => "تم الرفض", "EN" => "طالب منتظم");
     $old_state = ['DM' => 3, 'MW' => 3, 'CO' => 3, 'AP' => 3, 'VC' => 3, 'DN' => 3, 'CW' => 3, 'DU' => 3, 'DC' => 3, 'MN' => 3, 'VN' => 3, 'MVN' => 3, 'DX' => 3, 'XX' => 3, 'CN' => 15, 'EN' => 26];
     $reg_type = ['bachaleor' => 2, 'diplom' => 1, 'takmely' => 3];
     $reg_specialty = ['islam' => 2, 'feqh' => 1, 'general' => 3];
     $reg_stay_type = ['morafek' => 'companion', 'notresident' => 'non_resident', 'tourism' => 'tourism', 'work' => 'work'];
     $registrations = DB::connection('old')->table('registration')->get();
     $all_regs = [];
     foreach ($registrations as $registration) {
         //$new_registration = new Registration();
         $new_registration = [];
         //name
         $new_registration['id'] = $registration->reg_id;
         $new_registration['first_name'] = $registration->reg_firstname;
         $new_registration['second_name'] = $registration->reg_secondname;
         $new_registration['third_name'] = $registration->reg_thirdname;
         $new_registration['fourth_name'] = $registration->reg_fourthname;
         $new_registration['last_name'] = $registration->reg_lastname;
         $new_registration['last_name_latin'] = '';
         $new_registration['fourth_name_latin'] = '';
         $new_registration['third_name_latin'] = '';
         $new_registration['second_name_latin'] = '';
         $new_registration['first_name_latin'] = $registration->reg_englishname;
         //
         $new_registration['registration_type_id'] = $reg_type[$registration->reg_stage];
         $new_registration['academystructure_specialty_id'] = $reg_specialty[$registration->reg_specialist];
         //
         $new_registration['religion'] = $registration->reg_relegion;
         $new_registration['gender'] = $registration->reg_gender == 1 ? 'f' : 'm';
         //birthday
         $new_registration['birthday'] = $registration->reg_birthdate;
         $new_registration['birth_country_id'] = !empty($country[$registration->reg_birthcountryid]) ? $country[$registration->reg_birthcountryid] : 613;
         // nationality
         $new_registration['national_id'] = $registration->reg_nationalid;
         $new_registration['nationality_type'] = $registration->reg_nationality ? 'E' : 'O';
         $new_registration['nationality_country_id'] = !empty($country[$registration->reg_nationalitycountry]) ? $country[$registration->reg_nationalitycountry] : 613;
         //passport
         $new_registration['passeport_number'] = $registration->reg_passportnum;
         $new_registration['passeport_issued'] = $registration->reg_passportstartdate;
         $new_registration['passeport_expire'] = $registration->reg_passportenddate;
         $new_registration['passeport_country_id'] = !empty($country[$registration->reg_passportcountryid]) ? $country[$registration->reg_passportcountryid] : 613;
         //stay
         $new_registration['stay_expire'] = $registration->reg_stayenddate;
         $new_registration['stay_type'] = in_array($registration->reg_staytype, $reg_stay_type) ? $reg_stay_type[$registration->reg_staytype] : 'other';
         //contact
         $new_registration['contact_region'] = $registration->reg_contactregion;
         $new_registration['contact_postalbox'] = $registration->reg_contactpostalbox;
         $new_registration['contact_street'] = $registration->reg_contactstreet;
         $new_registration['contact_home_number'] = $registration->reg_contacthomenum;
         $new_registration['contact_email'] = $registration->reg_contactemail;
         $new_registration['contact_mobile'] = $registration->reg_contactmobile;
         $new_registration['contact_phone'] = $registration->reg_contacthomephone;
         $new_registration['contact_fax'] = $registration->reg_contactfax;
         $new_registration['contact_country_id'] = !empty($country[$registration->reg_contact_countryid]) ? $country[$registration->reg_contact_countryid] : 613;
         $new_registration['contact_city_id'] = $registration->reg_contactcityid > 0 ? $registration->reg_contactcityid : null;
         $new_registration['contact_state_id'] = null;
         //degree
         $new_registration['social_status'] = $registration->reg_socialmarital;
         $new_registration['degree_speciality'] = $registration->reg_eduspecialist;
         $new_registration['degree_institution'] = $registration->reg_eduplace;
         $new_registration['degree_score'] = $registration->reg_edugrade;
         $new_registration['degree_graduation_year'] = $registration->reg_eduendyear;
         $new_registration['degree_country_id'] = !empty($country[$registration->reg_edulevelcountry]) ? $country[$registration->reg_edulevelcountry] : 613;
         //social
         $new_registration['social_job'] = $registration->reg_socialworkjob;
         $new_registration['social_job_status'] = $registration->reg_socialworkstatus;
         $new_registration['social_job_start'] = $registration->reg_socialworkstart;
         $new_registration['social_experience'] = $registration->reg_socialworkexpert;
         $new_registration['social_job_employer'] = $registration->reg_socialworkplace;
         $new_registration['social_job_country_id'] = !empty($country[$registration->reg_socialworkcountryid]) ? $country[$registration->reg_socialworkcountryid] : 613;
         $new_registration['social_job_city_id'] = $registration->reg_socialworkcityid > 0 ? $registration->reg_socialworkcityid : null;
         $reg_socialworksector = '';
         if ($registration->reg_socialworksector == 'public') {
             $reg_socialworksector = 'government';
         }
         if ($registration->reg_socialworksector == 'private') {
             $reg_socialworksector = 'private';
         }
         if ($registration->reg_socialworksector == 'free') {
             $reg_socialworksector = 'freelance';
         }
         $new_registration['social_job_type'] = $reg_socialworksector;
         //others
         $new_registration['email_verified'] = 0;
         $new_registration['verification_token'] = '';
         $new_registration['debit'] = 0;
         //health
         $new_registration['health_status'] = $registration->reg_healthstatus;
         $new_registration['health_disabled_type'] = $registration->reg_healthdisabledtype;
         $new_registration['health_disabled_size'] = $registration->reg_healthdisabledsize;
         //skills
         $new_registration['computer_skills'] = $registration->reg_skillspc;
         $new_registration['internet_skills'] = $registration->reg_skillsnet;
         $new_registration['internet_link'] = $registration->reg_skillsgoodnetline;
         $new_registration['cyber_cafe'] = $registration->reg_skillsnearnet;
         $new_registration['computer_availability'] = $registration->reg_skillshaspc;
         //refrence
         $new_registration['reference'] = $registration->reg_skillsknowus;
         $new_registration['reference_other'] = $registration->reg_skillsknowustext;
         //period and prefix
         $period = '';
         $prefix = '';
         if ($registration->reg_eduyearid == '1') {
             $period = '1';
             $prefix = 'e2013';
         }
         if ($registration->reg_eduyearid == '2') {
             $period = '2';
             $prefix = 'e2014';
         }
         if ($registration->reg_eduyearid == '3') {
             $period = '3';
             $prefix = 'e2015';
         }
         $new_registration['username_prefix'] = $prefix;
         $new_registration['registration_period_id'] = $period;
         //
         $new_registration['registration_step_id'] = $old_state[$registration->reg_curstatus];
         //var_dump($new_registration->toArray());
         //$new_registration->save();
         $new_registration['created_at'] = new DateTime();
         $new_registration['updated_at'] = new DateTime();
         $all_regs[] = $new_registration;
     }
     ///var_dump($all_regs);
     foreach (array_chunk($all_regs, 500) as $chunk) {
         DB::table('registrations')->insert($chunk);
     }
     foreach (Registration::all() as $registration) {
         //$registration->generateCode();
     }
     $this->command->info('registration entered!');
 }
コード例 #11
0
ファイル: StepsController.php プロジェクト: hisambahaa/DARES
 public function resendspec(Request $request)
 {
     $current_period = RegistrationPeriod::orWhere(function ($query) {
         $query->whereDate('start_at', '<=', date('Y-m-d'));
         $query->whereDate('finish_at', '>=', date('Y-m-d'));
     })->orWhereDate('finish_at', '<=', date('Y-m-d'))->orderBy('id', 'desc')->first();
     if ($current_period) {
         if ($request->has('step_id')) {
             $registrations = Registration::where('registration_step_id', $request->input('step_id'))->where('registration_period_id', $current_period->id)->get();
             foreach ($registrations as $registration) {
                 $payload = ['send_to' => $registration->contact_email, 'send_to_name' => $registration->full_name, 'subject' => $request->input('email_subject'), 'data' => ['fullname' => $registration->full_name, 'template' => $request->input('email_template')]];
                 $message = $request->input('email_template');
                 $receivers = $registration->contact_mobile;
                 $registrationId = $registration->id;
                 $senderId = user()->id;
                 if ($request->has('email_template')) {
                     $this->dispatch(new SendRegistrationStepChangedEmail($payload));
                 }
                 if ($request->has('sms_template')) {
                     $this->dispatch(new SendRegistrationStepChangedSms($request->input('sms_template'), $receivers, $registrationId, $senderId));
                 }
             }
         }
         return redirect()->route('registration.steps.index')->with('success', trans('registration::steps.spec_send_success'));
     } else {
         return redirect()->route('registration.steps.index')->with('warning', trans('registration::steps.spec_send_fail'));
     }
 }
コード例 #12
0
ファイル: AuthController.php プロジェクト: alkindi91/DARES
 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]));
 }
コード例 #13
0
 public function store(RegisterRequest $request)
 {
     $error = 0;
     $message = '';
     $period = Period::current()->first();
     if (!$period) {
         $error = 1;
         $message = 'لا يوجد فترة تسجيل حاليا';
         return response()->json(compact('error', 'message'), 200, [], JSON_NUMERIC_CHECK);
     }
     $input = $request->all();
     $registration = new Registration();
     $registration->fill(array_filter($input));
     if (!$request->has('academystructure_specialty_id') || empty($request->input('academystructure_specialty_id'))) {
         if ($specialty = Specialty::where('code', 'G')->first()) {
             $registration->academystructure_specialty_id = $specialty->id;
         } else {
             $registration->academystructure_specialty_id = 1;
         }
     }
     $step = RegistrationStep::verifyEmail()->first();
     if (($reason = $this->canApply($input)) !== true) {
         $error = 1;
         switch ($reason) {
             case 'ACTIVE':
                 $message = 'الرقم المدني الذي تحاول التسجيل به، مستخدم من طرف طالب منتظم.';
                 break;
             case 'DELAYED':
                 $message = 'الرقم المدني الذي تحاول التسجيل به، مستخدم من طرف طالب مؤجل.';
                 break;
             case 'NO_DEGREES':
                 $message = 'لم تقم بادخال بيانات الشهادة';
                 break;
             case 'NO_SPECIALITY':
                 $message = 'لم تقم باختيار تخصص المرجو اعادة اختيار تخصص.';
                 break;
         }
         return response()->json(compact('error', 'message'), 200, [], JSON_NUMERIC_CHECK);
     }
     $password = !empty($registration->password) ? $registration->password : mt_rand(6, 10);
     $username = daress_generate_username();
     $registration->username = $username;
     $registration->password = bcrypt($password);
     $registration->registration_period_id = $period->id;
     $registration->registration_step_id = $step ? $step->id : NULL;
     $registration->passeport_country_id = !empty($input['passeport_country_id']) ? $input['passeport_country_id'] : null;
     if (!$registration->save()) {
         $error = 1;
         $message = 'لم يتم تسجيل طلبك المرجو اعادة المحاولة لاحقا.';
     } else {
         $registration->generateCode();
         /** check for extra degrees an dstore them */
         foreach ($input['degrees'] as $degree) {
             $registration->degrees()->create($degree);
         }
         foreach ($input['files'] as $file) {
             $file = RegistrationFile::find($file['id']);
             $file->update(['registration_id' => $registration->id]);
         }
         /** end check for extra degrees */
         event(new RegistrationCreated($registration));
         event(new RegistrationEmailChanged($registration, ['password' => $password]));
         event(new RegistrationUpdated($registration));
         event(new RegistrationStepChanged($registration, ['password' => $password, 'comment' => 'تفعيل البريد الإلكتروني']));
     }
     if ($error == 1) {
         return response()->json(compact('error', 'message'), 200, [], JSON_NUMERIC_CHECK);
     }
     $message = 'أحسنت ـ تم ارسال رسالة الى بريدك الالكتروني تحتوي على المعلومات التي تحتاجها من أجل الولوج لبوابة المتقدم.';
     $token = Auth::guard('api_registration')->generateTokenById($registration->id);
     return response()->json(compact('token'), 200, [], JSON_NUMERIC_CHECK);
 }
コード例 #14
0
ファイル: AuthController.php プロジェクト: hisambahaa/DARES
 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'));
 }