Esempio n. 1
0
Route::get('client', array('uses' => 'ClientController@homepage'));
Route::get('client/about', array('uses' => 'ClientController@about'));
Route::get('client/become-a-client', array('uses' => 'ClientController@becomeClient'));
Route::post('client/become-a-client', array('uses' => 'ClientController@saveClient'));
Route::get('client/contact-us', array('uses' => 'ClientController@contactUs'));
Route::post('client/contact-us', array('uses' => 'ClientController@contactClient'));
Route::get('client/news', array('uses' => 'ClientController@news'));
Route::get('client/sectors', array('uses' => 'ClientController@sectors'));
// Need to have candidate auth
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');
    }
}));