public function add_category() { $data_category = Input::all(); $validator_category = Validator::make(array('category_name' => $data_category['category_name']), array('category_name' => 'required|min:3|max:30')); $message = $validator_category->errors(); if ($validator_category->fails()) { return redirect()->back()->with('errors', $message); } else { $products = new Products(); $products->insert_category($data_category); $result_category = $products->get_category(); return view('auth/products')->with('result_category', $result_category); } }