Developer docs Core 2.2 · Pro 1.x

Search documentation

Search Core and Pro guides, including code examples.

PRO · COMMERCIAL

Verified badges.

Install the complete review experience, choose an interface, and configure customer and team workflows.

← All Pro topics

Verification

A badge proves an application-defined relationship, not a review's truthfulness. It is separate from email verification, invitation status, and approval.

php artisan vendor:publish --tag=review-rateable-pro-verification-migrations
php artisan migrate
'verification' => [
    'enabled' => true,
    'verifier' => App\Reviews\PurchaseReviewVerifier::class,
    'label' => 'Verified Purchase',
],

The label is customizable: Verified Purchase, Verified Booking, Verified Customer, or your own wording. Reviewers cannot assign badges.

Implement the verifier using trusted local records. This example assumes your application has orders with user_id, product_id, and status; adapt it for your schema, fulfillment, refunds, and tenant scope:

namespace App\Reviews;

use App\Models\Order;
use App\Models\Product;
use Codebyray\ReviewRateable\Models\Review;
use Codebyray\ReviewRateablePro\Contracts\ReviewVerifier;
use Codebyray\ReviewRateablePro\VerificationResult;
use Illuminate\Database\Eloquent\Model;

class PurchaseReviewVerifier implements ReviewVerifier
{
    public function verify(
        Model $reviewable,
        Review $review,
        ?Model $author
    ): ?VerificationResult {
        if (! $reviewable instanceof Product || $author === null) {
            return null;
        }

        $order = Order::on($review->getConnectionName())
            ->where('user_id', $author->getKey())
            ->where('product_id', $reviewable->getKey())
            ->where('status', 'completed')
            ->first();

        return $order === null ? null : new VerificationResult(
            'completed_order', (string) $order->getKey()
        );
    }
}

The verifier receives the persisted author, not the current visitor. Returning null grants no badge and removes stale evidence on a recheck. Missing/invalid evidence must not default to verified.

Pro creation and editing recheck automatically within their transactions. Lookup failures roll back those operations. Keep checks fast and local; synchronize remote evidence separately.

Badges are stored snapshots, not live queries. Connect refunds, cancellations, or evidence changes to trusted server-side rechecks:

use Codebyray\ReviewRateablePro\Services\ReviewVerificationManager;

$checks = app(ReviewVerificationManager::class);
$checks->refresh($review);
$checks->revoke($review);

These methods do not require an interactive login; your endpoint/job must supply its own authentication and authorization. Do not expose them as public actions. Use only non-secret evidence identifiers. Source/reference are hidden from normal serialization but not automatically encrypted; do not broadcast evidence-bearing objects publicly.