app/Http/Controllers/CategoryController.php
/**
     * Update the specified resource in storage.
     *
     * @param Request $request
     * @param Category $category
     * @return JsonResponse
     */
Update the specified resource in storage.
@param Request $request
@param Category $category
@return JsonResponse
Update the specified resource in storage . @param Request $request @param Category $category @return JsonResponse
public function update(Request $request, Category $category)
    {
        $request->validate(
            [
                'name' => 'nullable|unique:categories,name'
            ]
        );
        if ($category->update($request->all())){
            return Helper::response_with_data(Category::query()->find($category->id), false);
        }
        return Helper::response_with_data(null, true);
    }
public function update ( Request $ request , Category $ category ) { $ request -> validate ( [ 'name' => 'nullable|unique:categories,name' ] ) ; if ( $ category -> update ( $ request -> all ( ) ) ) { return Helper :: response_with_data ( Category :: query ( ) -> find ( $ category -> id ) , false ) ; } return Helper :: response_with_data ( null , true ) ; }
Update the specified resource in storage.
Update the specified resource in storage .