How to make redirect with request has ajax laravel

0

I have the following driver:

public function store(HolRegRequest $request, RecHoliday $reghol)
{
  $reghol->save();
  if ($request->has('ajax_submit')) {
     $response = ['message' => trans('messages.holext') . ' ' . 
     trans('messages.added'), 'status' => 'success'];
    return response()->json($response, 200, array('Access-Controll-Allow- 
    Origin' => '*'));
  }
  return redirect()->back()->withSuccess(trans('messages.holext') . ' ' . 
  trans('messages.added'));

} I would like one of the two things to happen:  when submit from the view, the serial field will have a random code again, since when submitting, it is saved in bd and the form is left blank  or that when doing submit redirects me to the homepage

    
asked by Jose Luis Tovar Fernandez 31.10.2018 в 14:25
source

0 answers