rules = [ 'immigration_status' => [ 'max:255'], ]; $this->messages = [ 'immigration_status.max' => translate('Max 255 characters'), ]; $rules = $this->rules; $messages = $this->messages; $validator = Validator::make($request->all(), $rules, $messages); if ($validator->fails()) { flash(translate('Something went wrong'))->error(); return Redirect::back()->withErrors($validator); } $recidencies = Recidency::where('user_id', $id)->first(); if(empty($recidencies)){ $recidencies = new Recidency; $recidencies->user_id = $id; } $recidencies->birth_country_id = $request->birth_country_id; $recidencies->recidency_country_id = $request->recidency_country_id; $recidencies->growup_country_id = $request->growup_country_id; $recidencies->immigration_status = $request->immigration_status; if($recidencies->save()){ flash(translate('Residency Info has been updated successfully'))->success(); return back(); } else { flash(translate('Sorry! Something went wrong.'))->error(); return back(); } } /** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // } }