wildwestriverrider/laravel-ratings-and-reviews

2.0.0 2023-10-03 13:55 UTC

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package allows you to add ratings and reviews to any model in your Laravel application.

Installation

You can install the package via composer:

composer require wildwestriverrider/laravel-ratings-and-reviews

You can publish and run the migrations with:

php artisan vendor:publish --tag="ratings-and-reviews-migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="ratings-and-reviews-config"

This is the contents of the published config file:

return [
    'max-rating' => 5,
    'min-rating' => 1
];

Usage

Traits

HasRatings - add this to the user model that will be giving ratings

HasReviews - add this to the user model that will be giving reviews

Rateable - add this to any model that should be rateable

Reviewable - add this to any model that should be reviewable

$laravelRatingsAndReviews = new Wildwestriverrider\LaravelRatingsAndReviews();

Testing

composer test