app/Http/Controllers/admin/CategoryController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, Category $category)
    {
         $request->validate([
            'name' => 'required',
            'slug' => "required|unique:categories,slug,$category->id"
        ]);
         $category->update($request->all());
         return redirect()->route('admin.categories.edit', $category)->with('info', 'la categoría se actualizó con exito');
    }
public function update ( Request $ request , Category $ category ) { $ request -> validate ( [ 'name' => 'required' , 'slug' => " required|unique:categories,slug, $ category -> id " ] ) ; $ category -> update ( $ request -> all ( ) ) ; return redirect ( ) -> route ( 'admin.categories.edit' , $ category ) -> with ( 'info' , 'la categoría se actualizó con exito'); }
Update the specified resource in storage.
Update the specified resource in storage .
//reglas de validación