public function exportRefereeTwo(Request $request) { $profile = Applications::where('reference_two_id', $request->segment(4))->first(); $ref = References::where('id', '=', $request->segment(4))->first(); $settings = Fields::where('references_id', '=', $request->segment(4))->first(); $pdf = PDF::loadView('pdf.refereetwo', compact('profile', 'ref', 'settings', 'custom')); $name = $profile->first_name . '-' . $profile->surname . '-references-'; $pdfFilename = urlencode(strtolower($name . '-' . date('d-m-Y') . '.pdf')); return $pdf->download($pdfFilename); }
public function refereeSubmittedTwo(Request $request) { $code = $request->segment(2); $refTwo = References::where('id', $request->input('referee_id'))->first(); $refTwo->referee_name = $request->input('name'); $refTwo->referee_start_date = $request->input('applicant_started'); $refTwo->referee_end_date = $request->input('date_left'); $refTwo->referee_email = $request->input('email_address'); $refTwo->position = $request->input('position'); $refTwo->leaving = $request->input('reason_for_leaving'); $refTwo->completedtwo = 'Yes'; $refTwo->re_employ = $request->input('re_employ'); $refTwo->update(); $fields = Fields::create($request->except('_token', 're_employ', 'referee_id', 'first_name', 'middle_name', 'surname', 'name', 'phone', 'position', 'email_address', 'applicant_started', 'date_left', 'reason_for_leaving', 'code')); //$settings = Settings::create($request->only('label', 'label2', 'label3', 'label4', 'label5', 'label6', 'label7', 'label8', 'label9', 'label10', 'company_id')); $settings = Settings::where('id', $refTwo->settings_id)->first(); $settings->fields_id = $fields->id; $settings->update(); $apps = Applications::where('code', $code)->first(); $apps->reference_two_id = $refTwo->id; $apps->update(); $fields->settings_id = $settings->id; $fields->references_id = $refTwo->id; $fields->update(); $segment = \Request::url(); $search = ['http://', 'https://', '.madesimpleapp', '.co.uk/', \Request::segment(1) . '/', \Request::segment(2) . '/', \Request::segment(3)]; $replace = ['', '', '', '', '', '', '']; $output = str_replace($search, $replace, $segment); $company = Company::where('url', $output)->first(); $refTwo->settings_id = $settings->id; $refTwo->company_id = $company->id; $refTwo->applications_id = $apps->id; $refTwo->update(); flash()->success('Success', 'Thank you for submission'); return redirect('/'); }
public function editCategory($id) { $fields = Fields::lists('name', 'id'); $categories = Categories::where('id', $id)->where('added_by', Session::get('id'))->first(); return view("pages.editCategory", ['categories' => $categories, 'fields' => $fields]); }
/** * Export PDF * * @param Request $request * @return mixed */ public function export(Request $request) { $profile = References::where('company_id', Auth::user()->company_id)->first(); $ref = References::where('id', '=', $request->segment(3))->first(); $settings = Fields::where('references_id', '=', $request->segment(3))->first(); $pdf = PDF::loadView('references.pdf', compact('profile', 'ref', 'settings')); $name = ucwords($ref->first_name) . '-' . ucwords($ref->last_name) . ' references '; $pdfFilename = urlencode(strtolower($name . '-' . date('d-m-Y') . '.pdf')); return $pdf->download($pdfFilename); }
/** * Handle the event. * * @param ReferenceRequestEmail $event * @return void */ public function handle(ReferenceRequestEmail $event) { // Handle Email Notification $companyId = Auth::user()->company_id; $cn = \App\Company::where('id', '=', $companyId)->first(); // Create record in applications table //$application = $this->createNewApplication($event); // Create record in references table $referee = $this->createNewReference($event); // Update Applications table with new reference ID //$this->updateApplication($referee, $application); // Create settings fields/options $settings = new Fields(); //$settings->application_id = $referee->id; $settings->references_id = $referee->id; $settings->label = $event->user['label']; $settings->label2 = $event->user['label2']; $settings->label3 = $event->user['label3']; $settings->label4 = $event->user['label4']; $settings->label5 = $event->user['label5']; $settings->label6 = $event->user['label6']; $settings->label7 = $event->user['label7']; $settings->label8 = $event->user['label8']; $settings->label9 = $event->user['label9']; $settings->label10 = $event->user['label10']; if (!empty($event->user['answer'])) { $settings->answer = $event->user['answer']; } if (!empty($event->user['answer2'])) { $settings->answer2 = $event->user['answer2']; } if (!empty($event->user['answer3'])) { $settings->answer3 = $event->user['answer3']; } if (!empty($event->user['answer4'])) { $settings->answer4 = $event->user['answer4']; } if (!empty($event->user['answer5'])) { $settings->answer5 = $event->user['answer5']; } if (!empty($event->user['answer6'])) { $settings->answer6 = $event->user['answer6']; } if (!empty($event->user['answer7'])) { $settings->answer7 = $event->user['answer7']; } if (!empty($event->user['answer8'])) { $settings->answer8 = $event->user['answer8']; } if (!empty($event->user['answer9'])) { $settings->answer9 = $event->user['answer9']; } if (!empty($event->user['answer10'])) { $settings->answer10 = $event->user['answer10']; } $settings->save(); $referee->settings_id = $settings->id; $referee->update(); if (!empty($event->user['email']) && $event->user['contact'] == 'Yes') { $data = array('email' => $event->user['email'], 'name' => $event->user['name'], 'worker' => $event->user['first_name'] . ' ' . $event->user['surname'], 'company' => $cn->name, 'code' => $referee->code); // Send the email Mail::send('emails/references/request', $data, function ($message) use($data) { $message->to($data['email'])->from('*****@*****.**')->subject('You have been selected to provide a reference'); }); } if (!empty($event->user['emailtwo']) && $event->user['contact2'] == 'Yes') { $refereetwo = $this->createNewReferenceTwo($event); $data = array('emailtwo' => $event->user['emailtwo'], 'name' => $event->user['name2'], 'worker' => $event->user['first_name'] . ' ' . $event->user['surname'], 'company' => $cn->name, 'code' => $refereetwo->code); // Send the email Mail::send('emails/references/request2', $data, function ($message) use($data) { $message->to($data['emailtwo'])->from('*****@*****.**')->subject('You have been selected to provide a reference'); }); } }