public function active() { $subjects = []; $fields = []; if (FinancialException::whereSemesterId(semester()->id)->whereStudentId($this->student->id)->whereActive(1)->count()) { return response()->json(false, 200, [], JSON_NUMERIC_CHECK); } $this->student->load('registration', 'registration.contactcountry', 'registration.contactcity'); $subjects = Subject::join('student_subjects as ss', function ($j) { $j->on('ss.subject_id', '=', 'subject_subjects.id')->where('student_id', '=', $this->student->id)->where('state', '=', 'study')->where('semester_id', '=', $this->semester->id)->where('payed', '=', 0); })->get()->toArray(); // if() { $study_fee = FinancialInvoiceItem::where('slug', 'study_fee')->first(); $study_fee = $study_fee ? $study_fee->amount : 0; // } else { // $study_fee = 6; // } $total_fee = 0; foreach ($subjects as &$subject) { $subject['fee'] = !$subject['is_quran'] ? $subject['hour'] * $study_fee : $subject['hour'] * 7.5; $total_fee += $subject['fee']; } if ($total_fee > 0) { if (!$this->student->registration) { return response()->json(false, 200, [], JSON_NUMERIC_CHECK); } $data = ['key' => 'student', 'value' => $this->student->username, 'transaction_id' => time(), 'amount' => $total_fee, 'bill_to_forename' => $this->student->registration->first_name, 'bill_to_surname' => $this->student->registration->last_name, 'bill_to_email' => $this->student->registration->contact_email, 'bill_to_address_line1' => $this->student->registration->adress, 'bill_to_phone' => $this->student->registration->contact_mobile, 'bill_to_address_city' => $this->student->registration->contactcity ? $this->student->registration->contactcity->name : '', 'bill_to_address_country' => 'OM']; $payment = new PaymentGateway($data); $fields = $payment->getData(); } if (empty($total_fee)) { return response()->json(false, 200, [], JSON_NUMERIC_CHECK); } return response()->json(compact('subjects', 'fields'), 200, [], JSON_NUMERIC_CHECK); }
/** * Store a newly created resource in storage. * @param Request $request * @return Response */ public function store(Request $request) { $order = new OrderDelay(); $order->fill($request->only('reason')); $order->student_id = $this->student->id; $order->academystructure_department_id = $this->student->academystructure_department_id; $order->semester_id = $this->semester->id; $order->state = 'تقديم'; $order->save(); // create order history record $history = new Orderhistory(); $history->ref_key = 'order_delays'; $history->ref_value = $order->id; $history->state = 'تقديم'; $history->save(); // check if financial item active then create debit record $invoice_item = FinancialInvoiceItem::where('slug', 'delayed_fee')->where('state', 'نشط')->first(); if ($invoice_item) { $invoice_data = ['ref_key' => 'order_delays', 'ref_value' => $order->id, 'student_id' => $this->student->id, 'amount' => $invoice_item->amount, 'type' => 'debit', 'semester_id' => $this->semester->id, 'item_id' => $invoice_item->id, 'note' => 'تكلفة طلب تاجيل دراسة']; FinancialInvoice::create($invoice_data); } if ($request->has('files')) { OrderFile::whereIn('id', array_pluck($request->input('files'), 'id'))->update(['ref_value' => $order->id, 'ref_key' => 'order_delays']); } $order->load('files'); return response()->json($order, 200, [], JSON_NUMERIC_CHECK); }
public function payment() { $registration = registrar(); $invoiceItem = FinancialInvoiceItem::where('slug', 'reg_fee')->first(); $data = ['key' => 'registration', 'value' => $registration->username, 'transaction_id' => time(), 'amount' => $invoiceItem->amount, 'bill_to_forename' => $registration->first_name, 'bill_to_surname' => $registration->last_name, 'bill_to_email' => $registration->contact_email, 'bill_to_address_line1' => $registration->adress, 'bill_to_phone' => $registration->contact_mobile, 'bill_to_address_city' => $registration->contactcity->name, 'bill_to_address_country' => $registration->contactcountry->iso_3166_2]; $payment = new PaymentGateway($data); return view('registration::registrar.payment', compact('payment')); }
/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); $invoice_items = [['name' => 'رسوم التقدم', 'slug' => 'reg_fee', 'amount' => 250, 'note' => 'رسوم تدفع اثناء عملة التقدم'], ['name' => 'رسوم الدارسة', 'slug' => 'study_fee', 'amount' => 15, 'note' => 'رسوم الساعه الواحده للمادة الدراسية'], ['name' => 'رسوم انسحاب', 'slug' => 'withdrawn_fee', 'amount' => 20, 'note' => 'رسوم الانسحاب من الدراسة'], ['name' => 'رسوم تأجيل', 'slug' => 'delayed_fee', 'amount' => 10, 'note' => 'رسوم تاجيل الدراسة لمده عام واحد'], ['name' => 'رسوم تظلم من الدرجات', 'slug' => 'Reevaluate_fee', 'amount' => 10, 'note' => 'رسوم التظلم من درجة مادة واحدة'], ['name' => 'رسوم مستحقة للطالب', 'slug' => 'moneyback_fee', 'amount' => 0, 'note' => 'رسوم يستردها الطالب من تاجيل او انسحاب او ...']]; $slugs = array_map(function ($ar) { return $ar['slug']; }, $invoice_items); FinancialInvoiceItem::whereIn('slug', $slugs)->delete(); foreach ($invoice_items as $item) { FinancialInvoiceItem::firstOrCreate($item); } // $this->call("OthersTableSeeder"); }
/** * Handle the event. * * @param UserAuthenticated $event * @return void */ public function handle(DelayOrderAccepted $event) { $delay_order = $event->order; //refund debit //create credit invoice if ($delay_order->refund_state > 0) { $moneyback_item = FinancialInvoiceItem::where('slug', 'moneyback_fee')->where('state', 'نشط')->first(); $study_item = FinancialInvoice::whereHas('item', function ($q) { $q->where('slug', 'study_fee'); })->where('semester_id', semester()->id)->where('type', 'debit')->first(); if ($study_item) { $invoiceData = ['ref_key' => 'order_delays', 'ref_value' => $delay_order->id, 'student_id' => $delay_order->student_id, 'amount' => $study_item->amount * $delay_order->refund_state / 100, 'type' => 'credit', 'pay_type' => 'system', 'item_id' => $moneyback_item->id, 'semester_id' => $delay_order->semester_id, 'note' => 'رسوم مستحقة من التأجيل']; FinancialInvoice::create($invoiceData); } } }
/** * Register the service provider. * * @return void */ public function register() { //Financial Financial::created(function ($fanancial) { UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Financial_fanancial', 'reference_id' => $fanancial->id]); }); Financial::updated(function ($fanancial) { UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Financial_fanancial', 'reference_id' => $fanancial->id]); }); Financial::deleted(function ($fanancial) { UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Financial_fanancial', 'reference_id' => $fanancial->id]); }); //FinancialInvoice FinancialInvoice::created(function ($invoice) { UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Financial_invoice', 'reference_id' => $invoice->id]); }); FinancialInvoice::updated(function ($invoice) { UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Financial_invoice', 'reference_id' => $invoice->id]); }); FinancialInvoice::deleted(function ($invoice) { UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Financial_invoice', 'reference_id' => $invoice->id]); }); //FinancialInvoiceItem FinancialInvoiceItem::created(function ($invoiceitem) { UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Financial_invoiceitem', 'reference_id' => $invoiceitem->id]); }); FinancialInvoiceItem::updated(function ($invoiceitem) { UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Financial_invoiceitem', 'reference_id' => $invoiceitem->id]); }); FinancialInvoiceItem::deleted(function ($invoiceitem) { UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Financial_invoiceitem', 'reference_id' => $invoiceitem->id]); }); //FinancialException FinancialException::created(function ($excuse) { UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Financial_execptions', 'reference_id' => $excuse->id]); }); FinancialException::updated(function ($excuse) { UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Financial_execptions', 'reference_id' => $excuse->id]); }); FinancialException::deleted(function ($excuse) { UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Financial_execptions', 'reference_id' => $excuse->id]); }); }
public function store(Request $request) { if ($request->other_reason_text) { $reason = $request->other_reason_text; } else { $reason = $request->reason; } // create order record $withdraw_order = new Withdraw(); $withdraw_order->student_id = student()->id; $withdraw_order->academystructure_department_id = student()->academystructure_department_id; $withdraw_order->semester_id = $request->input('semester_id'); $withdraw_order->state = 'تقديم'; $withdraw_order->reason = $reason; $withdraw_order->bank_name = request('bank_name'); $withdraw_order->bank_account_name = request('bank_account_name'); $withdraw_order->bank_account_number = request('bank_account_number'); $withdraw_order->save(); // create order history record $order_history = new Orderhistory(); $order_history->ref_key = 'order_withdraws'; $order_history->ref_value = $withdraw_order->id; $order_history->state = 'تقديم'; $order_history->save(); // check if financial item active then create debit record $withdraw_item = FinancialInvoiceItem::where('slug', 'withdraw_fee')->where('state', 'نشط')->first(); if ($withdraw_item) { if ($withdraw_item->amount > 0) { $invoiceData = ['ref_key' => 'order_withdraws', 'ref_value' => $delay_order->id, 'student_id' => student()->id, 'amount' => $delaye_item->amount, 'type' => 'debit', 'semester_id' => $request->input('semester_id'), 'item_id' => $delaye_item->id, 'note' => 'تكلفة طلب الانسحاب']; FinancialInvoice::create($invoiceData); } } // update uploaded files if (!empty(request('files'))) { $update_data = ['ref_key' => 'order_withdraws', 'ref_value' => $withdraw_order->id]; OrderFile::whereIn('id', request('files'))->update($update_data); } return redirect()->route('orders.index')->with('success', trans('orders::order.create_success')); }
/** * Handle the event. * * @param RegistrationStepChanged $event * @return void */ public function handle(RegistrationStepChanged $event) { $registration = $event->registration; $semester = semester(); $finish = $semester ? $semester->finish_at : date('Y-m-d'); if ($semester->order != 'first') { $semester = Semester::where('order', 'first')->where('start_at', '>', $finish)->orderBy('start_at', 'ASC')->first(); } if (empty($semester)) { return false; } $registration->load('step', 'student', 'contactcountry', 'files'); if ($registration->step->enroll == 1 && !$registration->student) { $equation_subjects_ids = RegistrationEquationSubject::whereNotNull('subject_id')->where('status', 'accepted')->whereHas('equation', function ($w) use($registration) { $w->where('registration_id', $registration->id); })->pluck('subject_id')->toArray(); $subject_ids = []; $i = 0; $department = 0; while (count(array_diff($subject_ids, $equation_subjects_ids)) == 0) { $department = Department::where('spec_id', $registration->academystructure_specialty_id)->where(function ($w) use($department) { $w->orWhere('parent_id', !empty($department->id) ? $department->id : 0); $w->orWhereNull('parent_id'); })->first(); $subject_ids = json_decode($department->subject_ids, TRUE); $i++; if ($i == 20) { break; } } if (empty($subject_ids)) { return false; } $subjects = Subject::whereIn('id', $subject_ids)->get(); $mobile = ($registration->contactcountry ? $registration->contactcountry->calling_code : "968") . $registration->contact_mobile; $data = ['username' => $registration->username, 'username_prefix' => $registration->enroll_code, 'password' => bcrypt($registration->contact_mobile), 'name' => $registration->fullname, 'email' => $registration->contact_email, 'mobile' => $mobile, 'state' => 'active', 'study_state' => 'active', 'national_id' => $registration->national_id, 'gender' => $registration->gender, 'registration_id' => $registration->id, 'academystructure_department_id' => $department->id, 'registration_type_id' => $registration->registration_type_id]; if ($registration->files) { $photo = $registration->files->first(function ($key, $value) { return $key == 'photo'; }); if ($photo) { // $data['photo'] = asset($photo->file->url()); } } Eloquent::unguard(); $student = Student::create($data); $invoiceItem = FinancialInvoiceItem::where('slug', 'study_fee')->first(); $study_fee = $registration->study_fee > 0 ? $registration->study_fee : $invoiceItem->amount; $total_amount = $subjects->sum(function ($s) use($equation_subjects_ids, $study_fee) { $amount = 0; if (!in_array($s->id, $equation_subjects_ids)) { $amount = !$s->is_quran ? $s->hour * (int) $study_fee : $s->hour * ((int) $study_fee / 2); } return $amount; }); if ($student) { if ($registration->debit && $invoiceItem) { $invoiceData = ['ref_key' => 'registrations', 'ref_value' => $registration->id, 'student_id' => $student->id, 'amount' => $registration->debit, 'type' => 'credit', 'item_id' => $invoiceItem->id, 'pay_type' => 'epay', 'bank_code' => $registration->reason_code, 'transaction_wid' => $registration->transaction_uuid, 'note' => 'ايصال دفع مصاريف التسجيل.']; FinancialInvoice::create($invoiceData); // create debit invoice $invoiceData = ['ref_key' => 'registrations', 'ref_value' => $registration->id, 'student_id' => $student->id, 'amount' => $total_amount, 'type' => 'debit', 'item_id' => $invoiceItem->id, 'pay_type' => 'epay', 'note' => 'فاتةورة التسجيل.']; FinancialInvoice::create($invoiceData); } foreach ($subjects as $subject) { $subject_state = in_array($subject->id, $equation_subjects_ids) ? 'equal' : 'study'; $subject_payed = in_array($subject->id, $equation_subjects_ids) ? 0 : 1; if (!$registration->debit && $registration->step->make_payment) { $subject_payed = 0; } $data = ['student_id' => $student->id, 'subject_id' => $subject->id, 'semester_id' => $semester->id, 'academystructure_department_id' => $department->id, 'state' => $subject_state, 'note' => '', 'payed' => $subject_payed]; $studentSubject = StudentSubject::create($data); } $historyData = ['student_id' => $student->id, 'state' => 'active', 'study_state' => 'active', 'academycycle_semester_id' => $semester->id, 'academystructure_department_id' => $department->id]; StudentHistory::create($historyData); $this->createStudentEmail($student, $registration->contact_mobile); try { if (!empty($photo)) { $student->photo = $photo; $student->save(); } } catch (\Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException $e) { } } //\Log::info('turn to student '.$response); } }
public function getPaymentSubjects() { $registrar = Auth::guard('api_registration')->user(); $registrar->load('contactcountry'); $department = Department::where('spec_id', $registrar->academystructure_specialty_id)->where(function ($w) { $w->orWhere('parent_id', 0); $w->orWhereNull('parent_id'); })->first(); $equation_subjects_ids = RegistrationEquationSubject::whereNotNull('subject_id')->where('status', 'accepted')->whereHas('equation', function ($w) use($registrar) { $w->where('registration_id', $registrar->id); })->pluck('subject_id')->toArray(); $subject_ids = $department ? json_decode($department->subject_ids, TRUE) : []; $subject_ids = array_diff($subject_ids, $equation_subjects_ids); $subjects = Subject::select('name', 'hour', 'is_quran')->whereIn('id', $subject_ids)->get()->toArray(); $study_fee = FinancialInvoiceItem::where('slug', 'study_fee')->first(); $study_fee = $registrar->study_fee > 0 ? $registrar->study_fee : $study_fee->amount; $total_fee = 0; foreach ($subjects as &$subject) { $subject['fee'] = !$subject['is_quran'] ? $subject['hour'] * $study_fee : $subject['hour'] * ($study_fee / 2); $total_fee += $subject['fee']; } $data = ['key' => 'registration', 'value' => trim($registrar->username), 'transaction_id' => time(), 'amount' => $total_fee, 'bill_to_forename' => trim($registrar->first_name), 'bill_to_surname' => trim($registrar->last_name), 'bill_to_email' => trim($registrar->contact_email), 'bill_to_address_line1' => 'غير متوفر', 'bill_to_phone' => trim($registrar->contact_mobile), 'bill_to_address_city' => trim($registrar->contactcity->name), 'bill_to_address_country' => 'OM']; $payment = new PaymentGateway($data); $fields = $payment->getData(); return response()->json(compact('subjects', 'fields'), 200, [], JSON_NUMERIC_CHECK); }
/** * Execute the job. * * @return void */ public function handle() { $student = Student::find($this->student_id); $currentSemester = semester(); $summerSemester = Semester::where('id', '>', $currentSemester->id)->where('order', 'summer')->orderBy('id', 'ASC')->first(); // Log::info($student->id, $currentSemester->id, $summerSemester->id); if ($student && $currentSemester && $summerSemester) { $nextSemester = Semester::where('id', '>', $currentSemester->id)->where('order', '!=', 'summer')->orderBy('id', 'ASC')->first(); if (!$nextSemester) { return false; } $current_department_id = $student->academystructure_department_id; if ($currentSemester->order != 'summer') { $nextDepartment = Department::where('parent_id', $student->academystructure_department_id)->first(); if ($nextDepartment) { $student->state = 'active'; $student->study_state = 'success'; $student->academystructure_department_id = $nextDepartment->id; } } $history = StudentHistory::where('student_id', $student->id)->orderBy('id', 'desc')->where('academycycle_semester_id', $currentSemester->id)->first(); if ($history) { $history->study_state = 'success'; $history->save(); } if ($student->save()) { // get current semester subjects and make them fail or success for current semester $subjects = StudentSubject::selectRaw("subsub.id as subject_id,SUM(stugr.value) AS subject_points,student_subjects.state as subject_state,subsub.name AS subject_name, subsub.hour AS subject_hours")->join('subject_subjects AS subsub', function ($join) { $join->on('subsub.id', '=', 'student_subjects.subject_id'); })->where('student_subjects.student_id', $student->id)->leftJoin('student_grades AS stugr', function ($join) use($currentSemester, $student) { $join->on('stugr.subject_id', '=', 'subsub.id')->where('stugr.semester_id', '=', $currentSemester->id)->where('stugr.student_id', '=', $student->id); })->whereIn('state', ['study'])->where('student_subjects.semester_id', '=', $currentSemester->id)->where('student_subjects.student_id', $student->id)->groupBy('subsub.id')->get(); $failed_subjects_ids = []; $passed_subjects_ids = []; foreach ($subjects as $subject) { if ($subject->subject_points < 50) { $failed_subjects_ids[] = $subject->subject_id; } elseif ($subject->subject_points >= 50) { $passed_subjects_ids[] = $subject->subject_id; } } StudentSubject::where('student_id', $student->id)->whereIn('subject_id', $failed_subjects_ids)->update(['state' => 'fail']); StudentSubject::where('student_id', $student->id)->whereIn('subject_id', $passed_subjects_ids)->update(['state' => 'success']); // end success and fail if ($currentSemester->order != 'summer' && $nextDepartment) { $next_subject_ids = json_decode($nextDepartment->subject_ids, TRUE); $equal_subject_ids = EqualSubject::whereHas('order', function ($w) use($student) { $w->where('student_id', $student->id); })->pluck('equal_subject_id')->toArray(); $next_subject_study_ids = array_diff($next_subject_ids, $equal_subject_ids); $next_subject_equal_ids = array_intersect($next_subject_ids, $equal_subject_ids); $student->subjects()->attach($next_subject_study_ids, ['semester_id' => $nextSemester->id, 'academystructure_department_id' => $nextDepartment->id, 'state' => 'study']); $student->subjects()->attach($next_subject_equal_ids, ['semester_id' => $nextSemester->id, 'academystructure_department_id' => $nextDepartment->id, 'state' => 'equal']); $data = ['state' => 'active', 'study_state' => 'active', 'academycycle_semester_id' => $nextSemester->id, 'academystructure_department_id' => $nextDepartment->id]; $student->histories()->create($data); // create invoice for student if ($next_subject_equal_ids) { $item = FinancialInvoiceItem::where('slug', 'study_fee')->first(); $subjects_count = Subject::whereIn('id', $next_subject_equal_ids)->where('is_quran', 0)->count(); $data = ['student_id' => $student->id, 'type' => 'debit', 'item_id' => $item->id, 'pay_type' => NULL, 'semester_id' => $nextSemester->id, 'amount' => $subjects_count * $item->amount]; FinancialInvoice::create($data); } } // move any failed subjects if less than 3 to summer semester $all_failed_subjects = StudentSubject::groupBy('subject_id')->where('state', 'fail')->pluck('subject_id')->toArray(); $all_passed_subjects = StudentSubject::groupBy('subject_id')->where('state', 'success')->pluck('subject_id')->toArray(); $failed_subjects = array_diff($all_failed_subjects, $all_passed_subjects); if (COUNT($failed_subjects) <= 3) { $summerSemester = Semester::where('id', '>', $currentSemester->id)->where('order', 'summer')->orderBy('id', 'ASC')->first(); $student->subjects()->attach($failed_subjects, ['semester_id' => $summerSemester->id, 'academystructure_department_id' => $current_department_id, 'state' => 'study']); $data = ['state' => 'active', 'study_state' => 'active', 'academycycle_semester_id' => $summerSemester->id, 'academystructure_department_id' => $current_department_id]; $student->histories()->create($data); } } } }
public function edit($itemid) { $items = FinancialInvoiceItem::findOrFail($itemid); return view('financials::items.edit', compact('items')); }
/** * Handle the event. * * @param RegistrationStepChanged $event * @return void */ public function handle($event) { $registration = $event->registration; $extra = $event->extra; $registration->load('step', 'step.notes', 'period', 'period.year', 'type', 'speciality'); $step = $registration->step; $password = isset($extra['password']) ? $extra['password'] : ''; if (empty($step->email_template)) { return true; } $notes = []; $comment = ''; if (isset($extra['comment'])) { $comment = $extra['comment']; } if (isset($extra['notes'])) { $notes = $extra['notes']; } /** * get next semester */ $firstday = ''; $semester = semester(); //Semester::where('id', semester()->id)->orderBy('academycycle_semesters.id', 'ASC')->first(); if ($semester) { $firstday = $semester->start_at; } /** * get subejcts for registrar */ $hours = 0; $fees = 0; if ($registration->academystructure_specialty_id) { $department = Department::where('spec_id', $registration->academystructure_specialty_id)->where(function ($w) { $w->orWhere('parent_id', 0); $w->orWhereNull('parent_id'); })->first(); $equation_subjects_ids = RegistrationEquationSubject::whereNotNull('subject_id')->where('status', 'accepted')->whereHas('equation', function ($w) use($registration) { $w->where('registration_id', $registration->id); })->pluck('subject_id')->toArray(); $subject_ids = $department ? json_decode($department->subject_ids, TRUE) : []; $subject_ids = array_diff($subject_ids, $equation_subjects_ids); $subjects = Subject::select('name', 'hour')->whereIn('id', $subject_ids)->get(); $hours = $subjects->sum('hour'); $study_fee = FinancialInvoiceItem::where('slug', 'study_fee')->first(); $fees = $hours * ($registration->subject_fee > 0 ? $registration->subject_fee : $study_fee->amount); } $years = 0; if ($registration->academystructure_specialty_id) { $years = Specialty::selectRaw('COUNT(adt.id) as terms, COUNT(DISTINCT ady.id) as years')->leftJoin('academystructure_departments as adp', 'adp.spec_id', '=', 'asp.id')->leftJoin('academystructure_terms as adt', 'adt.id', '=', 'adp.term_id')->leftJoin('academystructure_years as ady', 'ady.id', '=', 'adt.year_id')->from('academystructure_specialties as asp')->groupBy('asp.id')->where('asp.id', $registration->academystructure_specialty_id)->first()->years; } /** * end get registrar subjects */ $notes_html = ''; if ($notes = RegistrationStepNote::whereIn('id', $notes)->pluck('content')->toArray()) { $notes_html = '<ul><li>' . implode('</li><li>', $notes) . '</li></ul>'; } /* * calculate first term fees */ /* * end fees calculations */ $template = str_replace(['{reg_portal}', '{debit}', '{name}', '{code}', '{mobile}', '{username}', '{year}', '{nid}', '{shortname}', '{specialty}', '{today}', '{hours}', '{firstday}', '{notes}', '{years}', '{fees}', '{comment}', '{password}'], [env('REGSITRAR_EMAIL_EMAIL_VERIFIED_REDIRECT'), $registration->debit, $registration->fullname, $registration->code, $registration->contact_mobile, $registration->username, $registration->period->year->name, $registration->national_id, $registration->shortname, $registration->speciality ? $registration->speciality->name : '', date('Y-m-d'), $hours, $firstday, $notes_html, $years, $fees, $comment, $password], $step->email_template); $data = ['fullname' => $registration->fullname, 'template' => $template, 'verification_token' => $registration->verification_token]; $view = 'email_step'; if ($step->verify_email == 1) { $view = 'email_verification_token'; } if (!empty($registration)) { $payload = ['data' => $data, 'send_to' => $registration->contact_email, 'send_to_name' => $registration->fullname, 'subject' => $registration->step->name, 'view' => $view]; $job = new SendRegistrationStepChangedEmail($payload); $this->dispatch($job); } }