### Install Reviews for Laravel with Composer and Artisan Source: https://github.com/roundly-consulting/reviews-for-laravel/blob/main/README.md Run these commands to install the package, publish the reviews and media migrations, and run migrations. Requires PHP 8.4 and Laravel 12 or 13. Set REVIEWS_KEY_TYPE=uuid or ulid before migrating if models use UUID/ULID keys. ```bash composer require roundly-consulting/reviews-for-laravel php artisan vendor:publish --tag="reviews-migrations" php artisan vendor:publish --tag="media-migrations" # review photos live in media-library php artisan migrate ``` -------------------------------- ### Write, Moderate, and Read Reviews with the Reviews Facade Source: https://github.com/roundly-consulting/reviews-for-laravel/blob/main/README.md Create a review with rating, title, content, and verified flag; approve, respond, and vote on reviews; and read average rating, distribution, and paginated approved reviews. The create() method lands the review as pending. ```php use RoundlyConsulting\Reviews\Facades\Reviews; $review = Reviews::for($product)->by($user) ->rating(5) ->title('Loved it') ->content('Great value for the price') ->verified() // a verified purchase ->create(); // lands as pending Reviews::approve($review); Reviews::respond($review, $owner, 'Thanks for the feedback!'); Reviews::vote($review, $shopper, helpful: true); Reviews::for($product)->average(); // 5.0 Reviews::for($product)->distribution(); // [5 => 1] Reviews::for($product)->query()->approved()->mostHelpful()->paginate(); ``` -------------------------------- ### Make Models Reviewable and Reviewer with HasReviews and CanReview Source: https://github.com/roundly-consulting/reviews-for-laravel/blob/main/README.md Use the HasReviews trait on the model to be reviewed and CanReview on the reviewer model. Both traits come from the RoundlyConsulting\Reviews\Concerns namespace. ```php use RoundlyConsulting\Reviews\Concerns\CanReview; use RoundlyConsulting\Reviews\Concerns\HasReviews; class Product extends Model { use HasReviews; } class User extends Authenticatable { use CanReview; } ```