2017 © Pedro Peláez
 

library reportable

Reportable Polymorphic Eloquent Models for Laravel 5

image

misfits/reportable

Reportable Polymorphic Eloquent Models for Laravel 5

  • Saturday, June 2, 2018
  • by Tjoosten
  • Repository
  • 1 Watchers
  • 0 Stars
  • 54 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 2 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

Latest Version Total Downloads Software License, (*1)

Laravel Reportable

This package will allow you to add a full report system into your Laravel application., (*2)

Installation

First, pull in the package through Composer., (*3)

composer require ghanem/reportable

In Laravel 5.5 and higher the service provider will automatically get registered. In older versions of the framework just add the service provider in config/app.php file:, (*4)

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

At last you need to publish and run the migration., (*5)

php artisan vendor:publish

and, (*6)

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();

The Versions

02/06 2018

dev-develop

dev-develop

Reportable Polymorphic Eloquent Models for Laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by abdullah-ghanem

laravel report laravel 5.4 laravel 5.5 laravel 5.6

07/03 2018

dev-contributing

dev-contributing

Reportable Polymorphic Eloquent Models for Laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by abdullah-ghanem

laravel report laravel 5.4 laravel 5.5 laravel 5.6

06/03 2018

dev-master

9999999-dev

Reportable Polymorphic Eloquent Models for Laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by abdullah-ghanem

laravel report laravel 5.4 laravel 5.5 laravel 5.6

06/03 2018

1.2.1

1.2.1.0

Reportable Polymorphic Eloquent Models for Laravel 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by abdullah-ghanem

laravel report laravel 5.4 laravel 5.5 laravel 5.6

06/03 2018

1.2

1.2.0.0

Reportable Polymorphic Eloquent Models for Laravel 5

  Sources   Download

MIT

The Requires

 

by abdullah-ghanem

laravel report laravel 5.4 laravel 5.5 laravel 5.6

06/03 2018

dev-return-types

dev-return-types

Reportable Polymorphic Eloquent Models for Laravel 5

  Sources   Download

MIT

The Requires

 

by abdullah-ghanem

laravel report

23/10 2015

1.1

1.1.0.0

Reportable Polymorphic Eloquent Models for Laravel 5

  Sources   Download

MIT

The Requires

 

by abdullah-ghanem

laravel ajax blade

23/10 2015

1.0

1.0.0.0

Reportable Polymorphic Eloquent Models for Laravel 5

  Sources   Download

MIT

The Requires

 

by abdullah-ghanem

laravel ajax blade