app/Http/Controllers/Api/CategoryController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Models\Category  $category
     * @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|max:255',
            'slug'      => 'required|max:255|unique:categories,slug,' . $category->id
        ]);
        $category->update($request->all());
        return $category;
    }
public function update ( Request $ request , Category $ category ) { $ request -> validate ( [ 'name' => 'required|max:255' , 'slug' => 'required|max:255|unique:categories,slug,' . $ category -> id ] ) ; $ category -> update ( $ request -> all ( ) ) ; return $ category ; }
Update the specified resource in storage.
Update the specified resource in storage .