/** * Display a listing of the resource. * * @param int $id profile id * @return \Illuminate\Http\Response */ public function index($id) { $profile = Profile::findOrFail($id); $applications = collect(); foreach ($profile->applications as $application) { //$jobpost_id = $markedjobpost->jobpost_id; $line = Jobpost::byjobpostid($application->jobpost_id)->get()->first(); $applications->push($line); } return view('applications.index', compact('profile', 'applications')); }
/** * Display a list of the marked jobposts for the profile id * * @param int $id profile id * @return Response */ public function index($id) { //$markedjobposts = Markedjobpost::where('profile_id', $id)->get(); $profile = Profile::findOrFail($id); $markedposts = collect(); foreach ($profile->markedjobposts as $markedjobpost) { //$jobpost_id = $markedjobpost->jobpost_id; $line = Jobpost::byjobpostid($markedjobpost->jobpost_id)->get()->first(); $markedposts->push($line); } return view('markedjobposts.index', compact('profile', 'markedposts')); }
/** * Remove the specified resource from storage. * * @param int $eid employer_id * @param int $id jobpost_id * @return Response */ public function destroy($eid, $id) { $employer = Employer::findOrFail($eid); $jobpost = Jobpost::findOrFail($id); $jobpost->delete(); return view('jobposts.index', compact('employer')); }
/** * Lists the job posts of a job type . * * @param int $id profile id * @param int $tid job type id * @return Response */ public function forjobtype($id, $tid) { //dd($id); $profile = Profile::findOrFail($id); $jobposts = Jobpost::byjobtype($tid)->get(); $jobtype = Jobtype::findOrFail($tid); //return response()->json(compact('jobposts')); return view('candidate_jobposts.forjobtype', compact('profile', 'jobposts', 'jobtype')); }
/** * Display the specified resource. * * @param int $id jobpost id * @return Response */ public function show($id) { $jobpost = Jobpost::findOrFail($id); $coordinates = [$jobpost->location->latitude, $jobpost->location->longitude]; $tags = collect(); foreach ($jobpost->jobtags as $jobtag) { $tags->push($jobtag->name); } $jobpost = Jobpost::byjobpostid($id)->first(); //dd($jobpost->locat); return response()->json(compact('jobpost', 'coordinates', 'tags')); }
/** * Remove the specified resource from storage. * * @param int $iid jobpost id * @param int $id jobtag id * @return Response */ public function destroy($iid, $id) { $jobpost = Jobpost::findOrFail($iid); $jobtag = $jobpost->jobtags()->where('id', $id)->first(); $jobpost->jobtags()->detach($jobtag); return view('jobpost_jobtags.index', compact('jobpost')); }
/** * Update the specified resource in storage. * * @param int $eid employer_id * @param int $id jobpost_id * @param Request $request * @return Response */ public function update($id, Request $request) { $jobpost = Jobpost::findOrFail($id); //$location = Location::findOrFail($jobpost->location_id); $location = $jobpost->location; $location->address = $request->input('address'); $location->postal_code = $request->input('postal_code'); $location->city = $request->input('city'); $location->province = $request->input('province'); $location->country_code = $request->input('country_code'); $location->latitude = $request->input('latitude'); $location->longitude = $request->input('longitude'); $location->save(); //$jobpost->location_id = $location->id; //$jobpost->save(); return view('jobposts.index', compact('employer')); }