/** * 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('title', 'text'); $filter = $object->validator($params); if ($filter->fails()) { $error = $filter->errors()->toArray(); return view('admin.brand.create', ['input' => $params, 'error' => $error]); } $object->fill($params); $object->save(); return redirect('admin/brand/' . $object->id); }