app/Http/Controllers/CategoriesController.php
/**
     * Store a newly created resource in storage.
     *s
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
        $this->validate($request, [
          'name' => 'required|min:4|max:120|unique:categories',
      ]);
        $categoria = new Category($request->all());
        Flash::success('La categoria '.$categoria->name.' se ha guardado correctamente');
       $categoria->save();
       return redirect()->route('categories.index');
    }
public function store ( Request $ request ) { $ this -> validate ( $ request , [ 'name' => 'required|min:4|max:120|unique:categories' , ] ) ; $ categoria = new Category ( $ request -> all ( ) ) ; Flash :: success ( 'La categoria ' . $ categoria -> name . ' se ha guardado correctamente' ) ; $ categoria -> save ( ) ; return redirect ( ) -> route ( 'categories.index' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .