app/Http/Controllers/admin/CategoryController.php
/**
     * Store a newly created resource in storage.
     *
     * @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)
    {
        $request->validate([
            'name' => 'required',
            'slug' => 'required|unique:categories'
        ]);
            $category = Category::create($request->all());
            return redirect()->route('admin.categories.edit', $category)->with('info', 'la categoría se creó con exito');;
    }
public function store ( Request $ request ) { $ request -> validate ( [ 'name' => 'required' , 'slug' => 'required|unique:categories' ] ) ; $ category = Category :: create ( $ request -> all ( ) ) ; return redirect ( ) -> route ( 'admin.categories.edit' , $ category ) -> with ( 'info' , 'la categoría se creó con exito'); ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
//reglas de validación //return $request->all();