coliving/reportable 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

coliving/reportable

最新稳定版本:1.7

Composer 安装命令:

composer require coliving/reportable

包简介

Reportable Polymorphic Eloquent Models for Laravel 8, 9, 10, 11 & 12

README 文档

README

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 coliving/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

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

统计信息

  • 总下载量: 25.48k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固