PHPackages                             hewehi/laravel-model-review - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. hewehi/laravel-model-review

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

hewehi/laravel-model-review
===========================

User Create Reviews with rates and comments to any model

041[1 PRs](https://github.com/Husseinhewehii/laravel-model-review/pulls)PHP

Since Jul 24Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Husseinhewehii/laravel-model-review)[ Packagist](https://packagist.org/packages/hewehi/laravel-model-review)[ RSS](/packages/hewehi-laravel-model-review/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Model-Review: Laravel Package
=============================

[](#model-review-laravel-package)

[![Latest Stable Version](https://camo.githubusercontent.com/6c00a3fe0bd6c0a0a733f3904ed4302720535660c1afa2151c2fbec232718231/68747470733a2f2f706f7365722e707567782e6f72672f64677661692f6c61726176656c2d757365722d7265766965772f762f737461626c65)](https://packagist.org/packages/hewehi/laravel-model-review)[![Total Downloads](https://camo.githubusercontent.com/136f194d08b6443e13e2098de4186f59938f3df137e7d3a54dd6d97785de8208/68747470733a2f2f706f7365722e707567782e6f72672f64677661692f6c61726176656c2d757365722d7265766965772f646f776e6c6f616473)](https://packagist.org/packages/hewehi/laravel-model-review)[![Latest Unstable Version](https://camo.githubusercontent.com/221c7e69181805712e3e25659689238d89aa0cb6c56784699562cd45c0ab2bfe/68747470733a2f2f706f7365722e707567782e6f72672f64677661692f6c61726176656c2d757365722d7265766965772f762f756e737461626c65)](https://packagist.org/packages/hewehi/laravel-model-review)[![License](https://camo.githubusercontent.com/70b444fd586d87c7c3c8e711c483c757f9f9f7c9e3fc79062e2dd762c02e2bf6/68747470733a2f2f706f7365722e707567782e6f72672f64677661692f6c61726176656c2d757365722d7265766965772f6c6963656e7365)](https://packagist.org/packages/hewehi/laravel-model-review)

This package is derived from **Jalal Uddin**'s beautiful package [Github](https://github.com/dgvai-git) | [Linked-in](https://linkedin.com/in/dgvai) | [Facebook](https://facebook.com/dgvai.hridoy)which provides the ability for user to make review on any model on the system with rates and comments, with the privilege to the user to make more than one review on the same model.

I took it an added a new functionality which aligns with systems that allow users to make only one review on a model or update it.

### My LinkedIn

[](#my-linkedin)

[Husssein El-Hewehii](https://www.linkedin.com/in/hussein-el-hewehii-768b5a113/)

Requirements
------------

[](#requirements)

- PHP &gt;= 7.1
- Laravel &gt;= 5.6

Installation
------------

[](#installation)

> using COMPOSER

```
composer require hewehi/laravel-model-review
```

Configurations
--------------

[](#configurations)

> Export the assets (migration and config)

```
php artisan vendor:publish --provider="Hewehi\ModelReview\ModelReviewServiceProvider"
```

> Run the migration

```
php artisan migrate
```

> Clear configuration cache

```
php artisan config:cache
```

Usage
-----

[](#usage)

Add `Reviewable` trait to the model where you want users to give review and ratings. As example for **Product Model**

```

```

### Creating review for a product:

[](#creating-review-for-a-product)

> Description

`makeReview(object $user, int $rating , string $comment)`

`makeOrUpdateReview(object $user, int $rating , string $comment)`

`comment is optional`

> Returns

`Object instance of the review`

> Example

```
    $product = Product::find($id);
    $user = auth()->user();

    //user can add new review on this product even they have one
    $product->makeReview($user, 3, 'optional comment');

    //user can only update their review on this product or create a new one if they don't have any reviews yet
    $product->makeOrUpdateReview($user, 3, 'optional comment');
```

### Review attributes

[](#review-attributes)

```
    // Get all active reviews of the product
    $product->reviews();

    // Get neumetic review count (average)
    $product->rating;

    // Get percentage review count (average)
    $product->rating_percent;

    /**
    *   NOTE: THIS PERCENTAGE IS BASED ON 5 STAR RATING, IF YOU WANT CUSTOM STAR, USE BELLOW
    *   This is configured via the config file comes with this package: user-review.php
    *   You can also set environment variable for your systems default star count
    *
    *   (.env)  SYSTEM_RATING_STAR_COUNT=5
    */

    $product->averageRating(10);    //percentage for 10 starrted model

    // Get rating given to the product by a user:
    $product->userRating($user);

    /**
     *  Get Filtered Review
     *  Like, get only reviews that has been given 4 stars!
     *
    */

    $product->filter(4);

    /**
     * Get it's percentage, which can be shown in the progress bar!
     * */
    $product->filteredPercentage(4);      // ex: output: 75

    /**
     *  PULLING OUT REVIEWS
     *  There are several ways you can
     *  pull out reviews of products
    */

    // Get all reviews of all products
    $reviews = Hewehi\ModelReview\Review::all();              // all reviews
    $reviews = Hewehi\ModelReview\Review::active()->get();    // all active reviews
    $reviews = Hewehi\ModelReview\Review::inactive()->get();  // all inactive reviews
    $reviews = Hewehi\ModelReview\Review::daily()->get();     // all daily reviews
    $reviews = Hewehi\ModelReview\Review::monthly()->get();   // all monthly reviews
    $reviews = Hewehi\ModelReview\Review::yearly()->get();    // all yearly reviews

    // You can also chain these methods
    $reviews = Hewehi\ModelReview\Review::monthly()->active()->get();  // get aa monthly active reviews

    // Get reviews of a product
    $product->reviews();

    /**
     *  $reviews has some attributes
     *  Let's assume we are taking the first review
    */
    $review = $reviews->first();

    /**
     *  This the model object of the traited model
     *  In our case it is product
     *
    */

    $review->model;     //  so $review->model->name with return the $product->name
    $review->user;      //  return User model that reviewed the model

    // Get review text
    $review->review_text;

    // Get review reply
    $review->reply;

    // reply a review by admin:
    $review->reply('Thanks for being with us!');

    // making active/inactive
    $review->makeActive();
    $review->makeInactive();
```

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity25

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/afe3fb8fe13927f2bb3451e190ac7b5179954e11180e26cc0490fed57bfcf138?d=identicon)[husseinhewehii](/maintainers/husseinhewehii)

---

Top Contributors

[![Husseinhewehii](https://avatars.githubusercontent.com/u/45406735?v=4)](https://github.com/Husseinhewehii "Husseinhewehii (18 commits)")

### Embed Badge

![Health badge](/badges/hewehi-laravel-model-review/health.svg)

```
[![Health](https://phpackages.com/badges/hewehi-laravel-model-review/health.svg)](https://phpackages.com/packages/hewehi-laravel-model-review)
```

###  Alternatives

[stingbo/easyexchange

easy use digital currency exchange sdk

871.3k](/packages/stingbo-easyexchange)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
