rest_paginate( ReviewResource::collection( auth()->user()->reviews()->with(['product', 'product.brand'])->simplePaginate($request->perPage ?: 10) ) ); } /** * (*) Update review */ public function update(ProductReviewUpdate $request, Review $review): JsonResponse { $review->update($request->validated()); return response()->rest(message: 'Review updated successfully'); } /** * (*) Destroy the comment from product */ public function destroy(Review $review): JsonResponse { $review->delete(); return response()->rest(message: 'Review deleted successfully'); } }