app/Http/Controllers/Api/v1/RateController.php
/**
     * update an existing one Rate
     *
     * @return Illuminate\Http\Response
     */
update an existing one Rate
@return Illuminate\Http\Response
update an existing one Rate @return Illuminate \ Http \ Response
public function update(Request $request,$rate)
    {
        $this->validate($request,[
            'rate'=>'numeric|between:1,5',
            'user_id'=>'integer',
            'object_id'=>'integer',
            'category_id'=>'integer',
        ]);
        $rate = Rate::findOrFail($rate);
        --allow to update comment , rate fields only
        $rate->fill([
            $rate->comment = $request->comment,
            $rate->rate = $request->rate,
            ]);
        if($rate->isClean()){
            return $this->errorResponse("you didn't change any value",Response::HTTP_UNPROCESSABLE_ENTITY);
        }
        $rate->save();
        return $this->successResponse($rate);
    }
public function update ( Request $ request , $ rate ) { $ this -> validate ( $ request , [ 'rate' => 'numeric|between:1,5' , 'user_id' => 'integer' , 'object_id' => 'integer' , 'category_id' => 'integer' , ] ) ; $ rate = Rate :: findOrFail ( $ rate ) ; $ rate -> fill ( [ $ rate -> comment = $ request -> comment , $ rate -> rate = $ request -> rate , ] ) ; if ( $ rate -> isClean ( ) ) { return $ this -> errorResponse ( " you didn't change any value " , Response :: HTTP_UNPROCESSABLE_ENTITY ) ; } $ rate -> save ( ) ; return $ this -> successResponse ( $ rate ) ; }
update an existing one Rate
 @return Illuminate\Http\Response
update an existing one Rate @return Illuminate \ Http \ Response
// //--allow to update comment , rate fields only