wildwestriverrider / laravel-ratings-and-reviews
Ratings and reviews in Laravel 9+
3.0.1
2024-07-11 13:23 UTC
Requires
- php: ^8.1|^8.2|^8.3
- illuminate/contracts: ^v10.25.1|^v11.0.1
- spatie/laravel-package-tools: ^1.13.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^v7.9.0|^v8.0.0
- nunomaduro/larastan: ^v2.6.4
- orchestra/testbench: ^v8.12.1|^v9.0.0
- pestphp/pest: ^v2.19.2
- pestphp/pest-plugin-laravel: ^v2.2.0
- phpstan/extension-installer: ^1.3.1
- phpstan/phpstan-deprecation-rules: ^1.1.4
- phpstan/phpstan-phpunit: ^1.3.14
- phpunit/phpunit: ^10.3.5|^11.0.1
- spatie/laravel-ray: ^1.33.0
This package is auto-updated.
Last update: 2024-10-15 14:32:20 UTC
README
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