public function apply(Request $request) { $application = Applications::where('joboffersid', '=', $request->input('jobid'))->where('candidateid', '=', $request->input('id'))->first(); if (!is_object($application)) { $application = new Applications(); } $application->joboffersid = $request->input('jobid'); $application->candidateid = $request->input('id'); $application->save(); return response()->json(['success' => true]); }
public function selectCandidate(Request $request) { $statusid = $request->input('statusid'); $selected = Applications::find($request->input('appid')); switch ($statusid) { case 2: // finalist discatd each others $applied = Applications::where('joboffersid', '=', $request->input('jobid'))->get(); foreach ($applied as $app) { $app->statusid = 4; $app->save(); } break; default: break; } $selected->statusid = $statusid; $selected->save(); return response()->json(array('success' => true)); }