public function savedJobs() { $candidate = Session::get('candidate'); $jobs = SavedJob::where('candidate_id', '=', $candidate->id)->get(); return View::make('candidate.savedjobs')->with('candidate', $candidate)->with('jobs', $jobs); }
Route::get('save-job/{job_id}', array('as' => 'candidate.saveJob', function ($job_id) { if (!is_null(Session::get('candidate'))) { $candidate_id = Session::get('candidate')->id; $saved = new SavedJob(); $saved->job_id = $job_id; $saved->candidate_id = $candidate_id; $saved->save(); return Redirect::back()->withInfo('Job added to saved list.' . link_to('candidate/applications', 'View Now')); } else { return Redirect::to('become-a-candidate')->with('info', 'Please login / register to view this page'); } })); Route::get('save-job-remove/{job_id}', array('as' => 'candidate.removeJob', function ($job_id) { if (!is_null(Session::get('candidate'))) { $candidate_id = Session::get('candidate')->id; $saved = SavedJob::where('candidate_id', $candidate_id)->where('id', $job_id)->first(); $saved->delete(); return Redirect::back()->withInfo('Job removed from saved list.'); } else { return Redirect::to('become-a-candidate')->with('info', 'Please login / register to view this page'); } })); Route::get('candidate', array('as' => 'candidate.profile', 'uses' => 'CandidateController@candidatesFrontPage')); Route::post('candidate/imageUpload', function () { dd(Input::all()); if (is_null(Session::get('candidate'))) { return Redirect::to('become-a-candidate')->with('info', 'Please login / register to view this page'); } $candidate = Candidate::find(Session::get('candidate')->id); $testimonial = Content::where('type', 'testimonial')->where('client_facing', 1)->get()->random(1); $destinationPath = 'profile-image/';