Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function store(Request $request)
- {
- session_start();
- if(isset($_POST["captcha"]) && $_POST["captcha"]!="" && $_SESSION["code"]==$_POST["captcha"])
- {
- //
- $this->validate($request, [
- 'name' => 'required|max:255',
- 'sex' => 'required',
- 'marital_status' => 'required',
- 'date_of_birth' => 'required|date',
- 'photo' => 'required|dimensions:min_width=300,min_height=300,max_width=700,max_height=700|mimes:jpeg,jpg,png,JPG,JPEG,png,gif|max:80KB',
- 'fathers_name' => 'required',
- 'mothers_name' => 'required',
- 'spouses_name' => 'required',
- 'nationality' => 'required',
- 'present_add' => 'required',
- 'permanent_add' => 'required',
- 'district' => 'required',
- 'bank_draft_no' => 'required',
- 'resume' => 'required|mimes:pdf,docx,doc|max:700KB',
- 'contact_no' => 'required|numeric',
- 'captcha' => 'required',
- ]);
- }else{
- return Redirect::back()->withErrors(['Code is not Matching']);
- }
- $applicant = new Applicant();
- $applicant['name'] = $request->input('name');
- $applicant['sex'] = $request->input('sex');
- $applicant['marital_status'] = $request->input('marital_status');
- $applicant['date_of_birth'] = $request->input('date_of_birth');
- $applicant['email'] = $request->input('email');
- $applicant['fathers_name'] = $request->input('fathers_name');
- $applicant['mothers_name'] = $request->input('mothers_name');
- $applicant['spouses_name'] = $request->input('spouses_name');
- $applicant['nationality'] = $request->input('nationality');
- $applicant['present_add'] = $request->input('present_add');
- $applicant['permanent_add'] = $request->input('permanent_add');
- $applicant['bank_draft_no'] = $request->input('bank_draft_no');
- $applicant['ref_no'] = $request->input('ref_no');
- $applicant['quota'] = $request->input('quota');
- $applicant['district'] = $request->input('district');
- $applicant['resume'] = $request->input('resume');
- $applicant['contact_no'] = $request->input('contact_no');
- if ($request->hasFile('photo')) {
- $file = array('photo' => Input::file('photo'));
- $destinationPath = 'file/'; // upload path
- $extension = Input::file('photo')->getClientOriginalExtension();
- $fileName = rand(11111,99999).'.'.$extension; // renaming image
- Input::file('photo')->move($destinationPath, $fileName);
- $applicant->photo = $fileName;
- }else{
- echo "Please Add Your Photo!";
- }
- if ($request->hasFile('resume')) {
- $file = array('resume' => Input::file('resume'));
- $destinationPath = 'file/'; // upload path
- $extension = Input::file('resume')->getClientOriginalExtension();
- $fileName = rand(11111,99999).'.'.$extension; // renaming file
- Input::file('resume')->move($destinationPath, $fileName);
- $applicant->resume = $fileName;
- }else{
- echo "Please Add Your Resume!";
- }
- $job = Job::find($id);
- DB::table('applicants')->insert(['job_id' => $job->id]);
- $applicant->save();
- $id = $applicant->id;
- \Session::flash('flash_message','Application has been successfully submitted.');
- return Redirect::to('career/confirmation/'.$id);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement