/** * 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')); }
/** * 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')); }