/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $opportunity = $this->opportunity->find($id); $locations = Location::lists('location_name', 'id'); $group = Opportunity::find($id); $skills = Skill::all(); $assigned = $group->skills->lists('id'); if (is_null($opportunity)) { return Redirect::route('opportunities.index'); } return View::make('opportunities.edit', compact('opportunity', 'locations', 'group', 'skills', 'assigned')); }
public function showWelcome() { if (Sentry::check()) { $user = Sentry::getUser(); $group = User::find($user->id); $skills = Skill::all(); $assigned = $group->skills->lists('id'); $user_object = User::find($user->id); $locations = Location::all(); $location_assigned = $group->locations->lists('id'); //for an oppurtunity if and skills match then check against location $skillmatches = Skill::with('opportunities')->with('users')->has('opportunities')->has('users')->get(); //if the oppurtunity and location match send email and display in Matches on feed $events = Community_event::all(); //array to store docs without tags $usermatches = User::with('locations')->has('locations')->get(); $opportunitymatches = Opportunity::with('location')->with('skills')->get(); return View::make('hello', compact('skillmatches', 'opportunitymatches', 'skills', 'assigned', 'locations', 'location_assigned', 'events')); } else { return View::make('hello'); } }
$job->name = $app->request->post('title'); $job->description = $app->request->post('description'); $job->youtube = $urlvars['v']; $job->educationLevel()->associate($edu_level); $job->talent()->associate($talent); $job->save(); $data['new_occupation'] = $job; } } $app->render('occupations/edit.html', $data); })->via('GET', 'POST')->name('occupations_edit'); }); $app->group('/skills', function () use($app, $data) { $data['request_method'] = $app->request->getMethod(); $app->get('/', function () use($app, $data) { $data['skills'] = Skill::all(); $app->render('skills/overview.html', $data); })->name('skills_overview'); $app->map('/delete/:id', function ($id) use($app, $data) { $data['skill'] = Skill::find($id); if ($app->request->isPost()) { $data['skill']->delete(); } $app->render('skills/delete.html', $data); })->via('GET', 'POST')->name('skills_delete'); $app->map('/new', function () use($app, $data) { if ($app->request->isPost()) { $edu_level = EducationLevel::find($app->request->post('educationlevel')); $skill = new Skill(); $skill->name = $app->request->post('title'); $skill->save();
/** * Display a listing of the resource. * * @return Response */ public function index() { $skills = $this->skill->all(); return View::make('skills.index', compact('skills')); }
}); $app->get('/schooladvice', function () use($app) { $app->response()->header('Content-Type', 'application/json'); echo EducationLevel::SchoolAdvice()->get()->toJson(); }); $app->get('/schools', function () use($app) { $app->response()->header('Content-Type', 'application/json'); echo School::all()->toJson(); }); $app->get('/skills', function () use($app) { $app->response()->header('Content-Type', 'application/json'); echo Skill::all()->toJson(); }); $app->get('/occupation', function () use($app) { $app->response()->header('Content-Type', 'application/json'); echo Skill::all()->toJson(); }); $app->group('/user', function () use($app) { $app->options('/:name', function ($name) use($app) { $app->response()->header('Access-Control-Allow-Methods', 'PUT, GET, POST, DELETE, OPTIONS'); }); $app->options('/', function () use($app) { $app->response()->header('Access-Control-Allow-Methods', 'PUT, GET, POST, DELETE, OPTIONS'); }); $app->options('/progress', function () use($app) { $app->response()->header('Access-Control-Allow-Methods', 'GET, OPTIONS'); }); $app->options('/talent/:name', function () use($app) { $app->response()->header('Access-Control-Allow-Methods', 'PUT, GET, POST, DELETE, OPTIONS'); }); $app->options('/occupation', function () {
/** * Edit / Update User Profile */ public function getEdit($id) { try { //Get the current user's id. Sentry::check(); $currentUser = Sentry::getUser(); //Do they have admin access? if ($currentUser->hasAccess('admin')) { $group = User::find($id); $skills = Skill::all(); $assigned = $group->skills->lists('id'); $user_object = User::find($id); $locations = Location::all(); $location_assigned = $group->locations->lists('id'); $cities = City::orderBy('city_name')->lists('city_name', 'city_name'); $data['user'] = Sentry::getUserProvider()->findById($id); $data['userGroups'] = $data['user']->getGroups(); $data['allGroups'] = Sentry::getGroupProvider()->findAll(); return View::make('users.edit')->with($data)->with('cities', $cities)->with('skills', $skills)->with('assigned', $assigned)->with('locations', $locations)->with('location_assigned', $location_assigned); } elseif ($currentUser->getId() == $id) { $group = User::find($id); $skills = Skill::all(); $assigned = $group->skills->lists('id'); $user_object = User::find($id); $locations = Location::all(); $location_assigned = $group->locations->lists('id'); $cities = City::orderBy('city_name')->lists('city_name', 'city_name'); $data['user'] = Sentry::getUserProvider()->findById($id); $data['userGroups'] = $data['user']->getGroups(); return View::make('users.edit')->with($data)->with('cities', $cities)->with('skills', $skills)->with('group', $group)->with('assigned', $assigned)->with('locations', $locations)->with('location_assigned', $location_assigned); } else { Session::flash('error', 'You don\'t have access to that user.'); return Redirect::to('/'); } } catch (Cartalyst\Sentry\UserNotFoundException $e) { Session::flash('error', 'There was a problem accessing your account.'); return Redirect::to('/'); } }
/* |----------------------------------------------------------------------- | Locations |----------------------------------------------------------------------- */ Route::resource('locations', 'LocationsController'); /* |----------------------------------------------------------------------- | Opportunities |----------------------------------------------------------------------- */ Route::resource('opportunities', 'OpportunitiesController'); Route::post('/user/{id}/add', array('as' => 'skills.add', 'uses' => 'SkillsController@useradd')); Route::group(array('prefix' => 'v1'), function () { Route::get('skills', function () { $skills = Skill::all(); return Response::json($skills->toArray(), 201); }); Route::get('opportunities', function () { $opportunities = Opportunity::all(); return Response::json($opportunities->toArray(), 201); }); Route::get('skill-matches', function () { $skillmatches = Skill::with('opportunities')->with('users')->has('opportunities')->has('users')->get(); return Response::json($skillmatches->toArray(), 201); }); Route::get('opportunity-matches', function () { $opportunitymatches = Opportunity::with('location')->with('skills')->get(); return Response::json($opportunitymatches->toArray(), 201); }); Route::get('community-events', function () {