/**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create(Request $request)
 {
     // return $resumep;
     if (Auth::user()->type == 1 && Auth::user()->loginas == 1) {
         if ($request['skill']) {
             $skillsearch = SkillsInformation::select('pid')->where('skills', $request['skill'])->get()->toArray();
         } else {
             $skillsearch = PersonalInformation::select('id')->get()->toArray();
         }
         if ($request['qualification']) {
             $edusearch = EducationalInformation::select('pid')->where('degree', $request['qualification'])->get()->toArray();
         } else {
             $edusearch = PersonalInformation::select('id')->get()->toArray();
         }
         $resumep = PersonalInformation::join('experienceinformation', 'personalinformation.id', '=', 'experienceinformation.pid')->where('personalinformation.country', 'LIKE', '%' . $request['country'] . '%')->where('personalinformation.fname', 'LIKE', '%' . $request['name'] . '%')->where('personalinformation.inumber', 'LIKE', '%' . $request['passportNo'] . '%')->where('personalinformation.age', 'LIKE', '%' . $request['age'] . '%')->where('personalinformation.height', 'LIKE', '%' . $request['height'] . '%')->where('experienceinformation.experience', 'LIKE', '%' . $request['experience'] . '%')->whereIn('personalinformation.id', $skillsearch)->whereIn('personalinformation.id', $edusearch)->orderBy('personalinformation.id', 'desc')->paginate(20);
         return view('resume.index')->with('resumep', $resumep);
     } else {
         if (Auth::user()->type == 3 || Auth::user()->loginas == 3) {
             if ($request['skill']) {
                 $skillsearch = SkillsInformation::select('pid')->where('skills', $request['skill'])->get()->toArray();
             } else {
                 $skillsearch = PersonalInformation::select('id')->get()->toArray();
             }
             if ($request['qualification']) {
                 $edusearch = EducationalInformation::select('pid')->where('degree', $request['qualification'])->get()->toArray();
             } else {
                 $edusearch = PersonalInformation::select('id')->get()->toArray();
             }
             $resumep = PersonalInformation::join('experienceinformation', 'personalinformation.id', '=', 'experienceinformation.pid')->where('personalinformation.country', 'LIKE', '%' . $request['country'] . '%')->where('personalinformation.fname', 'LIKE', '%' . $request['name'] . '%')->where('personalinformation.inumber', 'LIKE', '%' . $request['passportNo'] . '%')->where('personalinformation.age', 'LIKE', '%' . $request['age'] . '%')->where('personalinformation.height', 'LIKE', '%' . $request['height'] . '%')->where('experienceinformation.experience', 'LIKE', '%' . $request['experience'] . '%')->whereIn('personalinformation.id', $skillsearch)->whereIn('personalinformation.id', $edusearch)->where('personalinformation.agent_id', '=', Auth::user()->id)->orderBy('personalinformation.id', 'desc')->paginate(20);
             return view('resume.index')->with('resumep', $resumep);
         } else {
             if ($request['skill']) {
                 $skillsearch = SkillsInformation::select('pid')->where('skills', $request['skill'])->get()->toArray();
             } else {
                 $skillsearch = PersonalInformation::select('id')->get()->toArray();
             }
             if ($request['qualification']) {
                 $edusearch = EducationalInformation::select('pid')->where('degree', $request['qualification'])->get()->toArray();
             } else {
                 $edusearch = PersonalInformation::select('id')->get()->toArray();
             }
             // return $edusearch;
             $resumeSearch = PersonalInformation::join('experienceinformation', 'personalinformation.id', '=', 'experienceinformation.pid')->join('privacyinformation', 'personalinformation.id', '=', 'privacyinformation.pid')->where('privacyinformation.privacy', '=', 1)->where('personalinformation.country', 'LIKE', '%' . $request['country'] . '%')->where('personalinformation.fname', 'LIKE', '%' . $request['name'] . '%')->where('personalinformation.inumber', 'LIKE', '%' . $request['passportNo'] . '%')->where('personalinformation.age', 'LIKE', '%' . $request['age'] . '%')->where('personalinformation.height', 'LIKE', '%' . $request['height'] . '%')->where('experienceinformation.experience', 'LIKE', '%' . $request['experience'] . '%')->whereIn('personalinformation.id', $skillsearch)->whereIn('personalinformation.id', $edusearch)->where(function ($cquery) {
                 $cquery->where('personalinformation.approval_status', '=', 0)->orwhereIn('personalinformation.approved_by', [1, Auth::user()->id]);
             })->orderBy('personalinformation.id', 'desc')->paginate(10);
             // $resumeSearch->setPath('resumeSearch');
             return view('employer.approval_index')->with('resump', $resumeSearch);
         }
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     if ($id != 0) {
         $resumdel1 = PersonalInformation::where('id', $id)->delete();
         $resumdel2 = EducationalInformation::where('pid', $id)->delete();
         $resumdel3 = WorkInformation::where('pid', $id)->delete();
         $resumdel4 = Language::where('pid', $id)->delete();
         $resumdel5 = SkillsInformation::where('pid', $id)->delete();
         $resumdel = AdditionalInformation::where('pid', $id)->delete();
         $resumdel = UploadInformation::where('pid', $id)->delete();
         $resumdel = PrivacyInformation::where('pid', $id)->delete();
     } else {
         $deleteChecked = Input::get('resume');
         if ($deleteChecked) {
             foreach ($deleteChecked as $delete) {
                 $resumdel1 = PersonalInformation::where('id', $delete)->delete();
                 $resumdel2 = EducationalInformation::where('pid', $delete)->delete();
                 $resumdel3 = WorkInformation::where('pid', $delete)->delete();
                 $resumdel4 = Language::where('pid', $delete)->delete();
                 $resumdel5 = SkillsInformation::where('pid', $delete)->delete();
                 $resumdel = AdditionalInformation::where('pid', $delete)->delete();
                 $resumdel = UploadInformation::where('pid', $delete)->delete();
                 $resumdel = PrivacyInformation::where('pid', $delete)->delete();
             }
             Session::flash('message', 'Successfully deleted');
             $history = new History();
             $history->action_id = 0;
             $history->action = 'Resume deleted';
             $history->user = Auth::user()->name;
             $history->remark = 'Number of Resume deleted=' . count($deleteChecked);
             $history->save();
         } else {
             Session::flash('nrmessage', 'Resume are not Selected');
         }
     }
     return Redirect::to('resume');
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     if ($id != 0) {
         $resumdel1 = PersonalInformation::where('id', $id)->delete();
         $resumdel2 = EducationalInformation::where('pid', $id)->delete();
         $resumdel3 = WorkInformation::where('pid', $id)->delete();
         $resumdel4 = Language::where('pid', $id)->delete();
         $resumdel5 = SkillsInformation::where('pid', $id)->delete();
         $resumdel = AdditionalInformation::where('pid', $id)->delete();
         $resumdel = UploadInformation::where('pid', $id)->delete();
         $resumdel = PrivacyInformation::where('pid', $id)->delete();
     } else {
         $deleteChecked = Input::get('resume');
         if ($deleteChecked) {
             foreach ($deleteChecked as $delete) {
                 $resumdel1 = PersonalInformation::where('id', $delete)->delete();
                 $resumdel2 = EducationalInformation::where('pid', $delete)->delete();
                 $resumdel3 = WorkInformation::where('pid', $delete)->delete();
                 $resumdel4 = Language::where('pid', $delete)->delete();
                 $resumdel5 = SkillsInformation::where('pid', $delete)->delete();
                 $resumdel = AdditionalInformation::where('pid', $delete)->delete();
                 $resumdel = UploadInformation::where('pid', $delete)->delete();
                 $resumdel = PrivacyInformation::where('pid', $delete)->delete();
             }
         }
     }
     Session::flash('message', 'Successfully deleted');
     return Redirect::to('resume');
 }