laravel-reviewRateable icon indicating copy to clipboard operation
laravel-reviewRateable copied to clipboard

countRating is getting null value

Open Joshmatjjen opened this issue 5 years ago • 0 comments

``public function rateMechanic($id,Request $request){ $user = auth('api')->user(); $mechanic = User::find($id);

    $rating = $mechanic -> rating([
        // 'title' => 'Some title',
        // 'body' => 'Some body', //optional
        // 'anonymous' => 1, //optional
        'rating' => $request['rate'],
    ], $user);
    // $average = $mechanic->averageRating();
    $request->merge(['averageRating' => $mechanic->countRating()]);
    // $request->merge(['reviews' => $mechanic->countRating()]);
    $mechanic->update($request->all());

    dd($rating);
}``

Joshmatjjen avatar Jun 11 '19 13:06 Joshmatjjen