NewWe open-sourced 50+ Laravel packages
Custom AI apps, agents and automation — Roundly ConsultingRoundly
All packages
Reviews for Laravel

Preparing your models

Mark a subject as reviewable and an author as a reviewer with one trait each:

use Illuminate\Database\Eloquent\Model;
use RoundlyConsulting\Reviews\Concerns\CanReview;
use RoundlyConsulting\Reviews\Concerns\CanVoteOnReviews;
use RoundlyConsulting\Reviews\Concerns\HasReviews;

class Restaurant extends Model
{
    use HasReviews;          // the reviewable subject
}

class User extends Model
{
    use CanReview;           // writes reviews
    use CanVoteOnReviews;    // votes reviews helpful / unhelpful
}
  • HasReviews — for subjects: the reviews, topLevelReviews and approvedReviews relations, live aggregates (averageRating(), ratingSummary() and more) and addReview().
  • CanReview — for authors: the reviewsAuthored relation, hasReviewed() and reviewFor().
  • CanVoteOnReviews — for voters: voteOn(), removeVoteFrom(), hasVotedOn() and votedHelpfulOn().
  • MaintainsReviewAggregates — optional, alongside HasReviews: keeps cached reviews_count / reviews_avg columns in sync.

Anything can review anything

The traits are conveniences — the facade accepts any Eloquent model as author or subject. A model can hold both roles, which makes two-way feedback trivial:

class Guest extends Model
{
    use CanReview;
    use HasReviews;
}

class Host extends Model
{
    use CanReview;
    use HasReviews;
}

// After a stay, both sides review each other with the same API.
Reviews::for($host)->by($guest)->rating(5)->content('Spotless flat, great tips')->create();
Reviews::for($guest)->by($host)->rating(5)->content('Ideal guest, left it tidy')->create();

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

By donating, you agree to our donation terms.

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.