コード例 #1
0
 /**
  * Сохранение данных заявки
  * с предварительной валидацией данных
  * 
  */
 public function store(PublicOrder $publicOrder, Request $request)
 {
     Session::reflash();
     $input = $request->all();
     $validateData = $this->validateData($input);
     $validation = Validator::make($validateData['input'], $validateData['rules'], $validateData['messages']);
     if ($validation->fails()) {
         return redirect()->route('validateError')->withInput()->withErrors($validation);
     }
     $validateData['input']['phone'] = phone_format($validateData['input']['phone'], 'RU');
     $publicOrder->saveOrder($validateData['input']);
     $this->orderEmail($validateData['input']);
     return view('public.thanks', ['input' => $validateData['input']]);
 }