gpablore/laravel-user-review
Add Google Play–style user reviews and star/point ratings to any Eloquent model via a simple trait. Users can leave one review with optional text; admins can post a single support reply. Includes migrations, config, and helpers for averages and percentages.
Pros:
Product, Service, Listing), aligning with Laravel’s convention of reusable components.Cons:
Reviewable trait bundles ratings, reviews, and admin replies into one unit. Could lead to tight coupling if future requirements diverge (e.g., separating ratings from reviews).ReviewCreated, AdminReplyAdded) for extensibility.users table (for reviewers/admins) and a reviewable model (e.g., Product). May need schema adjustments if using non-standard auth (e.g., API tokens, guest reviews).spatie/laravel-reviews, cartalyst/sentinel for auth-bound reviews)?/products/{id}/reviews), but frontend display logic must be handled separately.Pre-Integration:
review_text, rating, admin_reply) to avoid data loss.Installation:
composer require dgvai/laravel-user-review
php artisan vendor:publish --provider="DGvai\Review\ReviewerServiceProvider"
php artisan migrate
php artisan config:cache
config/review.php) for rating ranges, reply limits.Model Integration:
Reviewable trait to your model (e.g., Product.php):
use DGvai\Review\Traits\Reviewable;
class Product extends Model {
use Reviewable;
}
getRatingOptions()) for custom logic.Frontend Setup:
API (If Applicable):
POST /products/{id}/reviews (create review).POST /reviews/{id}/replies (admin reply).GET /products/{id}/reviews (list reviews).Testing:
addReview(), addAdminReply()).users table. Custom auth (e.g., Sanctum, Passport) may need adjustments.FormRequest for complex rules.spatie/laravel-reviews).laravel-validator).Product, Service).reviewable_id, created_at).How can I help you explore Laravel packages today?