ghanem/reportable

Reportable Polymorphic Eloquent Models for Laravel 5
7,583 33
Install
composer require ghanem/reportable
Latest Version:v1.2
PHP:>=7.2.0
License:MIT
Last Updated:Aug 2, 2026
Links: GitHub  ·  Packagist
Maintainer: ghanem

Latest Version Total Downloads Software License

Laravel Reportable

This package will allow you to add a full report system into your Laravel application.

Installation

First, pull in the package through Composer.

composer require ghanem/reportable

And then include the service provider within app/config/app.php.

'providers' => [
    Ghanem\Reportable\ReportableServiceProvider::class
];

At last you need to publish and run the migration.

php artisan vendor:publish --provider="Ghanem\Reportable\ReportableServiceProvider"

and

php artisan migrate

Setup a Model

<?php

namespace App;

use Ghanem\Reportable\Contracts\Reportable;
use Ghanem\Reportable\Traits\Reportable as ReportableTrait;
use Illuminate\Database\Eloquent\Model;

class Post extends Model implements Reportable
{
    use ReportableTrait;
}

Examples

The User Model reports the Post Model

<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;

use App\Post;
use Auth;

class PostController extends Controller
{
    public function makeReport()
    {
        $post = Post::find(1);
        $user = Auth::user();
        
        $post->report([
            'reason' => str_random(10),
            'meta' => ['some more optional data, can be notes or something'],
        ], $user);
    }

Create a conclusion for a Report and add the User Model as "judge" (useful to later see who or what came to this conclusion)

$report->conclude([
    'conclusion' => 'Your report was valid. Thanks! We\'ve taken action and removed the entry.',
    'action_taken' => 'Record has been deleted.' // This is optional but can be useful to see what happend to the record
    'meta' => ['some more optional data, can be notes or something'],
], $user);

Get the conclusion for the Report Model

$report->conclusion;

Get the judge for the Report Model (only available if there is a conclusion)

$report->judge(); // Just a shortcut for $report->conclusion->judge

Get an array with all Judges that have ever "judged" something

Report::allJudges();

Credits

This package began life in 2015 as an MIT-licensed package by DraperStudio, originally authored by Dzung Nguyen. The upstream repository is no longer published. It has been maintained by GAIT ever since. The original copyright notice is retained in LICENSE.

License

MIT. See LICENSE.

Related Packages

alikhosravidev/laravel-verbose-validator

Adds a verbose/trace mode to the Laravel Validator for easier debugging of compl...

2 4
jimmyjs/laravel-report-generator

Rapidly Generate Simple Pdf & Excel Report on Laravel 5 (Using Barryvdh/DomPdf o...

172,425 577
coliving/reportable

Reportable polymorphic Eloquent models for Laravel 8 through 13

28,878 1
djereg/error-report

Detailed error report via e-mail for Laravel 4.

44 0