return View::make('cvbuilder.section_views.add_new_section'); }); Route::get('/edit_ui_section/{id}', function ($id) { $section = Section::find($id); return View::make('cvbuilder.section_views.edit_new_section', ['section' => $section]); }); Route::get('/edit_ui_workex/{id}', function ($id) { $work = WorkExperience::find($id); return View::make('cvbuilder.section_views.edit_work', ['work' => $work]); }); Route::get('/edit_ui_education/{id}', function ($id) { $education = Education::find($id); return View::make('cvbuilder.section_views.edit_education', ['edu' => $education]); }); Route::get('/edit_ui_nysc/{id}', function ($id) { $nysc = Nysc::find($id); return View::make('cvbuilder.section_views.edit_nysc', ['nysc' => $nysc]); }); Route::get('/edit_ui_language/{id}', function ($id) { $language = Language::find($id); $langs = DB::table('langs')->lists('language', 'id'); $langs = array("0" => "Select") + $langs + array("-1" => "Others"); $levels = DB::table('levels')->lists('level', 'id'); $abilities = DB::table('abilities')->lists('ability', 'id'); return View::make('cvbuilder.section_views.edit_language', ['lang' => $language, 'langs' => $langs, 'levels' => $levels, 'abilities' => $abilities]); }); Route::post('/fetch_addsection', 'CVController@postSection'); Route::post('/edit_section', 'CVController@putSection'); Route::post('/edit_work', 'CVController@putwork'); Route::post('/edit_education', 'CVController@puteducation'); Route::post('/edit_nysc', 'CVController@putnysc');
public function duplicatecvpage($cv_code) { $cv_old = Cv::where('cv_code', $cv_code)->first(); if ($cv_old->user_id != Auth::id()) { return 'False'; } $new_cv_name = $cv_old->cv_name . ' - Copy'; $cv = new Cv(); do { $random = str_random(10); $count = Cv::where('cv_code', $random)->count(); } while ($count != 0); $cv->cv_code = $random; if (Auth::check()) { $cv->user_id = Auth::id(); } $cv->cv_name = $new_cv_name; $cv->user_id = $cv_old->user_id; $cv->full_name = $cv_old->full_name; $cv->phone_num = $cv_old->phone_num; $cv->email = $cv_old->email; $cv->website = $cv_old->website; $cv->add_line1 = $cv_old->add_line1; $cv->add_line2 = $cv_old->add_line2; $cv->dob = $cv_old->dob; $cv->marital_status = $cv_old->marital_status; $cv->profile_image = $cv_old->profile_image; $cv->sex = $cv_old->sex; $cv->state_origin = $cv_old->state_origin; $cv->religion = $cv_old->religion; $cv->religion_text = $cv_old->religion_text; $cv->show_profile_pic = $cv_old->show_profile_pic; $cv->local_government = $cv_old->local_government; $cv->save(); $new_cv_id = $cv->id; // copying sections $sections = Section::where('cv_id', $cv_old->id)->get(); foreach ($sections as $section) { $section_new = new Section(); $section_new->cv_id = $new_cv_id; $section_new->section_name = $section->section_name; $section_new->type = $section->type; $section_new->content = $section->content; $section_new->default = $section->default; $section_new->priority = $section->priority; $section_new->save(); } // copying educations $educations = Education::where('cv_id', $cv_old->id)->get(); foreach ($educations as $education) { $education_new = new Education(); $education_new->cv_id = $new_cv_id; $education_new->coursename = $education->coursename; $education_new->institutename = $education->institutename; $education_new->add_line1 = $education->add_line1; $education_new->add_line2 = $education->add_line2; $education_new->startdate = $education->startdate; $education_new->enddate = $education->enddate; $education_new->otherinfo = $education->otherinfo; $education_new->priority = $education->priority; $education_new->save(); } // copying languages $languages = Language::where('cv_id', $cv_old->id)->get(); foreach ($languages as $language) { $language_new = new Language(); $language_new->cv_id = $new_cv_id; $language_new->language_id = $language->language_id; $language_new->language_name = $language->language_name; $language_new->ability_id = $language->ability_id; $language_new->level_id = $language->level_id; $language_new->priority = $language->priority; $language_new->save(); } // copying nysc $nyscs = Nysc::where('cv_id', $cv_old->id)->get(); foreach ($nyscs as $nysc) { $nysc_new = new Nysc(); $nysc_new->cv_id = $new_cv_id; $nysc_new->year = $nysc->year; $nysc_new->batch = $nysc->batch; $nysc_new->ppa = $nysc->ppa; $nysc_new->cd = $nysc->cd; $nysc_new->otherinfo = $nysc->otherinfo; $nysc_new->priority = $nysc->priority; $nysc_new->save(); } // copying work_exp $work_exps = WorkExperience::where('cv_id', $cv_old->id)->get(); foreach ($work_exps as $work_exp) { $work_exp_new = new WorkExperience(); $work_exp_new->cv_id = $new_cv_id; $work_exp_new->title = $work_exp->title; $work_exp_new->company = $work_exp->company; $work_exp_new->location = $work_exp->location; $work_exp_new->startdate = $work_exp->startdate; $work_exp_new->enddate = $work_exp->enddate; $work_exp_new->otherinfo = $work_exp->otherinfo; $work_exp_new->priority = $work_exp->priority; $work_exp_new->save(); } return Redirect::back(); }
public function deleteNysc($nysc_id, $code) { $cv = Cv::where('cv_code', $code)->first(); $cv_id = $cv->id; Nysc::where('id', $nysc_id)->where('cv_id', $cv_id)->delete(); $data["success"] = 1; $data["message"] = "Succefully deleted"; return json_encode($data); }