public function getHome() { $postedjobs = PostedJob::with('industry', 'employer', 'exam', 'subject')->where('status', 1)->orderBy('created_by', 'ASC')->paginate(20); $top_jobs = PostedJob::with('industry', 'employer')->where('status', 1)->orderBy('salary_offered_min', 'DESC')->take(5)->get(); //here I am taking 5 recrds with highest minimum salary and only the available jobs // $filtered = $collection->filter(function ($item) { // return $item > 2; // }); return view('webfront.index', compact('postedjobs', 'top_jobs')); }
public function jobUpdateStatus($id, Request $request) { $decoded = Hashids::decode($id); $id = $decoded[0]; $modal = PostedJob::findOrFail($id); $modal->status = $request->status; if ($modal->save()) { return redirect()->back()->with('message', 'Status has been successfully Updated'); } else { return redirect()->back()->with('message', 'Unable to process your request'); } }
public function deleteJob($id) { $decoded = Hashids::decode($id); $id = $decoded[0]; if (PostedJob::findOrFail($id)->delete()) { return redirect()->back()->with('message', 'The Job has been Successfully Deleted!'); } else { return redirect()->back()->with('message', 'Unable to process your request. Please try again.'); } }