PHPackages                             inpin/lara-report - 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. [Database &amp; ORM](/categories/database)
4. /
5. inpin/lara-report

ActivePackage[Database &amp; ORM](/categories/database)

inpin/lara-report
=================

Add Reportable trait to Laravel Eloquent models

1.0.3(7y ago)3913MITPHPPHP &gt;=7.0

Since Jun 3Pushed 7y ago1 watchersCompare

[ Source](https://github.com/inpin/lara-report)[ Packagist](https://packagist.org/packages/inpin/lara-report)[ RSS](/packages/inpin-lara-report/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (4)Dependencies (8)Versions (5)Used By (0)

LaraReport
==========

[](#larareport)

[![Build Status](https://camo.githubusercontent.com/27315cb4822422129e7b06c76acde6ae14450de89e7f7a62012508b24699ac53/68747470733a2f2f7472617669732d63692e6f72672f696e70696e2f6c6172612d7265706f72742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/inpin/lara-report)[![StyleCI](https://camo.githubusercontent.com/e2599f85844c316ead4013c914982163129ab41b7194934b8a3d6a6456437eae/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3133353739353934382f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/135795948)[![Maintainability](https://camo.githubusercontent.com/cecfa437bc7d83e0d12095318bbdaf49371788f9ddd1577d318a779e6cc4b507/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f36303332666335326436646263336431386636392f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/inpin/lara-report/maintainability)[![Latest Stable Version](https://camo.githubusercontent.com/3c7bf11a908caf53369e375eba29596d1b0a4f0c0c97053b10b38a03d0fe3eb1/68747470733a2f2f706f7365722e707567782e6f72672f696e70696e2f6c6172612d7265706f72742f762f737461626c65)](https://packagist.org/packages/inpin/lara-report)[![Total Downloads](https://camo.githubusercontent.com/d0d18f90bd5beaebf91bbc98975e833bfd0155563404c17635bc5b0c96459619/68747470733a2f2f706f7365722e707567782e6f72672f696e70696e2f6c6172612d7265706f72742f646f776e6c6f616473)](https://packagist.org/packages/inpin/lara-report)[![Latest Unstable Version](https://camo.githubusercontent.com/583e77f84d40a9956490e6799e7622196df72fe62ae5761ea65f15c04ff18464/68747470733a2f2f706f7365722e707567782e6f72672f696e70696e2f6c6172612d7265706f72742f762f756e737461626c65)](https://packagist.org/packages/inpin/lara-report)[![License](https://camo.githubusercontent.com/2ef1c81e2ef107725fe28a727a368938a7e375219c8769557e6aaa9185ff92a4/68747470733a2f2f706f7365722e707567782e6f72672f696e70696e2f6c6172612d7265706f72742f6c6963656e7365)](https://packagist.org/packages/inpin/lara-report)

Trait for Laravel Eloquent models to allow easy implementation of a "user report" feature.

#### Composer Install (for Laravel 5.5 and above)

[](#composer-install-for-laravel-55-and-above)

```
composer require inpin/lara-report

```

#### Install and then run the migrations

[](#install-and-then-run-the-migrations)

```
'providers' => [
    \Inpin\LaraReport\LaraReportServiceProvider::class,
],
```

```
php artisan vendor:publish --provider="Inpin\LaraReport\LaraReportServiceProvider" --tag=migrations
php artisan migrate
```

#### Setup your models

[](#setup-your-models)

```
class Book extends \Illuminate\Database\Eloquent\Model {
    use Inpin\LaraReport\Reportable;
}
```

#### Sample Usage

[](#sample-usage)

Firstly it needs to be seeded in `larareport_report_items` table.

```
ReportItem::query()->create([
    'type'  => 'books',
    'title' => 'Price is incorrect',
]);
```

the `type` field is just for categorizing, I suggest to put your model morph name into it.

```
// Create an empty report by currently logged in user.
$book->createReport();

// Create a report on $book object with "report item id" of 1 and 2, with message of null,
// and put current logged in user form default guard as reporter.
$book->createReport([1, 2]);

// Create a report on $book object with "report item id" of 1 and 2, and put user message of "some message on it",
// and put current logged in user form default guard as reporter.
$book->createReport([1, 2], 'some message');

// Create a report on $book object with "report item id" of 1 and 2, put user message of "some message on it",
// and put current logged in user form 'api' guard as reporter.
$book->createReport([1, 2], 'some message', 'api');

// Create a report on $book object with "report item id" of 1 and 2, put user message of "some message on it",
// and put $user (3rd param) as reporter.
$book->createReport([1, 2], 'some message', $user');

$book->reports(); // HasMany relation to reports of book.
$book->reports; // Collection of book's reports.

$book->isReported() // check if current logged in user form default guard has reported book.
$book->isReported // check if current logged in user form default guard has reported book.
$book->isReported('api') // check if current logged in user form 'api' guard has reported book.
$book->isReported($user) // check if '$user' has reported book.

$book->reportsCount; // return number of reports on $book.
$book->reportsCount(); // return number of reports on $book.
```

Report objects

```
$report->assign(); // Assign current logged from default guard as admin of $report
$report->assign('api'); // Assign current logged from 'api' guard as admin of $report
$report->assign($user); // Assign $user as admin of $report

// set resolved_at with current timestamp and assign current logged from default guard as admin of $report
$report->resolve();

// set resolved_at with current timestamp and assign current logged from 'api' guard as admin of $report
$report->resolve('api');

// set resolved_at with current timestamp and assign $user as admin of $report
$report->resolve($user);

// check if $report is resolved or not.
$report->isResolved();
```

#### Credits

[](#credits)

- Mohammad Nourinik -

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~1 days

Total

4

Last Release

2896d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/83b1e9074067bce11d6d2c783c057677dc8542e51dbd068e532b9f28cb0dc166?d=identicon)[enourinick](/maintainers/enourinick)

---

Top Contributors

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

---

Tags

eloquenterrorfaultinpinissuelarareportlaravellaravel5phpreportreportablespamtraitlaravelerroreloquenttraitspamreportlaravel5faultissuereportable

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/inpin-lara-report/health.svg)

```
[![Health](https://phpackages.com/badges/inpin-lara-report/health.svg)](https://phpackages.com/packages/inpin-lara-report)
```

###  Alternatives

[cybercog/laravel-ban

Laravel Ban simplify blocking and banning Eloquent models.

1.1k651.8k11](/packages/cybercog-laravel-ban)[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k302.7k1](/packages/cybercog-laravel-love)[rtconner/laravel-likeable

Trait for Laravel Eloquent models to allow easy implementation of a 'like' or 'favorite' or 'remember' feature.

394388.0k5](/packages/rtconner-laravel-likeable)[cviebrock/eloquent-taggable

Easy ability to tag your Eloquent models in Laravel.

567694.8k3](/packages/cviebrock-eloquent-taggable)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)[cybercog/laravel-ownership

Laravel Ownership simplify management of Eloquent model's owner.

9126.6k3](/packages/cybercog-laravel-ownership)

PHPackages © 2026

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