예제 #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $object = new Model();
     $params = $request->only('ru_unit', 'en_unit', 'ua_unit', 'ru_text', 'en_text', 'ua_text');
     $filter = $object->validator($params);
     if ($filter->fails()) {
         $error = $filter->errors()->toArray();
         return view('admin.unit.create', ['input' => $params, 'error' => $error]);
     }
     $object->fill($params);
     $object->save();
     return redirect('admin/unit/' . $object->id);
 }