---
title: "Reviews & ratings — Shops for Laravel | Roundly"
description: "Product reviews and rating aggregates via reviews-for-laravel, with verified-purchase flagging from paid and fulfilled orders."
url: https://roundly-consulting.com/open-source/docs/shops-for-laravel/reviews
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

[Shops for Laravel](https://roundly-consulting.com/open-source/docs/shops-for-laravel.md)

# Reviews & ratings

Products are reviewable via reviews-for-laravel, with star ratings, optional text, moderation and rating aggregates:

```php
$product->addReview($user)
    ->rating(5)
    ->title('Great')
    ->content('Love it')
    ->approved()
    ->create();

$product->reviews();              // MorphMany<Review>
$product->approvedReviews();      // MorphMany<Review>
$product->reviewsCount();         // int
$product->approvedReviewsCount(); // int
$product->averageRating();        // ?float — approved reviews only
$product->ratingDistribution();   // [5 => 12, 4 => 3, ...]
$product->ratingSummary();        // RatingSummary {average, count, distribution}
```

## Verified purchase

$product->review($user) begins a review pre-flagged as a verified purchase by the bound VerifiedPurchaseResolver, then returns the reviews package’s fluent builder. $product->addReview($user) is the un-flagged builder:

```php
// Pre-flags the review as a verified purchase via the bound resolver:
$product->review($user)
    ->rating(5)
    ->title('Excellent')
    ->content('Exactly as described.')
    ->create();   // Review — verified set automatically
```

The default NullVerifiedPurchaseResolver never verifies. DatabaseVerifiedPurchaseResolver verifies an author with an order that is both paid and fulfilled and contains the product — matched through the order’s customer, so orders need a linked customer:

```php
// config/shops.php
'reviews' => [
    'verified_purchase_resolver' => \RoundlyConsulting\Shops\Reviews\DatabaseVerifiedPurchaseResolver::class,
],
```

Or implement the contract for your own purchase lookup:

```php
use Illuminate\Database\Eloquent\Model;
use RoundlyConsulting\Shops\Products\Product;
use RoundlyConsulting\Shops\Reviews\Contracts\VerifiedPurchaseResolver;

final class CrmVerifiedPurchaseResolver implements VerifiedPurchaseResolver
{
    public function verified(Model $author, Product $product): bool
    {
        // your own purchase lookup, e.g. against an external order system
        return false;
    }
}
```

The review builder also takes photos (withPhoto(), withPhotos(), withPhotoFromUrl(), withPhotoFromDisk(), withDraftPhoto()) — see the reviews-for-laravel docs.

## Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

[More ways to support, including crypto](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source/docs/shops-for-laravel.md)
