/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function store(Request $request) { if ($request->currentlyemployed == 1) { $this->validate($request, ['company' => 'required', 'jobtitle' => 'required', 'currentlyemployed' => 'required', 'startdate' => 'required', 'jobdescription' => 'required']); } else { $this->validate($request, ['company' => 'required', 'jobtitle' => 'required', 'currentlyemployed' => 'required', 'startdate' => 'required', 'enddate' => 'required', 'jobdescription' => 'required']); } Job::create($request->all()); return redirect('jobs')->with('success', 'Successfully saved job!'); }