Downloads
Stars
Version
This package will allow you to add a full abuse report system into your Laravel application. Forked from AbdullahGhanem/reportable
First, pull in the package through Composer.
composer require lifeids/abusereportable
And then include the service provider within app/config/app.php
.
'providers' => [
Lifeids\AbuseReportable\AbuseReportableServiceProvider::class
];
At last you need to publish and run the migration.
php artisan vendor:publish
and
php artisan migrate
<?php
namespace App;
use Lifeids\AbuseReportable\Contracts\AbuseReportable;
use Lifeids\AbuseReportable\Traits\Reportable as AbuseReportableTrait;
use Illuminate\Database\Eloquent\Model;
class Post extends Model implements AbuseReportable
{
use AbuseReportableTrait;
}
<?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->abusereport([
'reason' => str_random(10),
'meta' => ['some more optional data, can be notes or something'],
], $user);
}
$abusereport->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);
$abusereport->conclusion;
$abusereport->judge(); // Just a shortcut for $report->conclusion->judge
AbuseReport::allJudges();