{"id":28398664,"url":"https://github.com/inpin/lara-report","last_synced_at":"2025-06-28T18:32:12.234Z","repository":{"id":56991902,"uuid":"135795948","full_name":"inpin/lara-report","owner":"inpin","description":"Trait for Laravel Eloquent models to allow easy implementation of a \"user report\" feature.","archived":false,"fork":false,"pushed_at":"2018-06-09T11:28:45.000Z","size":22,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-01T13:54:09.394Z","etag":null,"topics":["eloquent","error","fault","inpin","issue","larareport","laravel","laravel5","php","report","reportable","spam","trait"],"latest_commit_sha":null,"homepage":"https://inpinapp.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/inpin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-02T07:08:43.000Z","updated_at":"2020-08-21T19:54:14.000Z","dependencies_parsed_at":"2022-08-21T13:50:18.278Z","dependency_job_id":null,"html_url":"https://github.com/inpin/lara-report","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/inpin/lara-report","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inpin%2Flara-report","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inpin%2Flara-report/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inpin%2Flara-report/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inpin%2Flara-report/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inpin","download_url":"https://codeload.github.com/inpin/lara-report/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inpin%2Flara-report/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262476250,"owners_count":23317238,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eloquent","error","fault","inpin","issue","larareport","laravel","laravel5","php","report","reportable","spam","trait"],"created_at":"2025-06-01T05:39:04.649Z","updated_at":"2025-06-28T18:32:12.228Z","avatar_url":"https://github.com/inpin.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"LaraReport\n============\n[![Build Status](https://travis-ci.org/inpin/lara-report.svg?branch=master)](https://travis-ci.org/inpin/lara-report)\n[![StyleCI](https://github.styleci.io/repos/135795948/shield?branch=master)](https://github.styleci.io/repos/135795948)\n[![Maintainability](https://api.codeclimate.com/v1/badges/6032fc52d6dbc3d18f69/maintainability)](https://codeclimate.com/github/inpin/lara-report/maintainability)\n[![Latest Stable Version](https://poser.pugx.org/inpin/lara-report/v/stable)](https://packagist.org/packages/inpin/lara-report)\n[![Total Downloads](https://poser.pugx.org/inpin/lara-report/downloads)](https://packagist.org/packages/inpin/lara-report)\n[![Latest Unstable Version](https://poser.pugx.org/inpin/lara-report/v/unstable)](https://packagist.org/packages/inpin/lara-report)\n[![License](https://poser.pugx.org/inpin/lara-report/license)](https://packagist.org/packages/inpin/lara-report)\n\nTrait for Laravel Eloquent models to allow easy implementation of a \"user report\" feature.\n\n#### Composer Install (for Laravel 5.5 and above)\n\n\tcomposer require inpin/lara-report\n\n#### Install and then run the migrations\n\n```php\n'providers' =\u003e [\n    \\Inpin\\LaraReport\\LaraReportServiceProvider::class,\n],\n```\n\n```bash\nphp artisan vendor:publish --provider=\"Inpin\\LaraReport\\LaraReportServiceProvider\" --tag=migrations\nphp artisan migrate\n```\n\n#### Setup your models\n\n```php\nclass Book extends \\Illuminate\\Database\\Eloquent\\Model {\n    use Inpin\\LaraReport\\Reportable;\n}\n```\n\n#### Sample Usage\n\nFirstly it needs to be seeded in `larareport_report_items` table.\n```php\nReportItem::query()-\u003ecreate([\n    'type'  =\u003e 'books',\n    'title' =\u003e 'Price is incorrect',\n]);\n```\n\nthe `type` field is just for categorizing, I suggest to put your model morph name into it.\n\n```php\n// Create an empty report by currently logged in user.\n$book-\u003ecreateReport();\n\n// Create a report on $book object with \"report item id\" of 1 and 2, with message of null,\n// and put current logged in user form default guard as reporter.\n$book-\u003ecreateReport([1, 2]);\n\n// Create a report on $book object with \"report item id\" of 1 and 2, and put user message of \"some message on it\",\n// and put current logged in user form default guard as reporter.\n$book-\u003ecreateReport([1, 2], 'some message');\n\n// Create a report on $book object with \"report item id\" of 1 and 2, put user message of \"some message on it\",\n// and put current logged in user form 'api' guard as reporter.\n$book-\u003ecreateReport([1, 2], 'some message', 'api');\n\n// Create a report on $book object with \"report item id\" of 1 and 2, put user message of \"some message on it\",\n// and put $user (3rd param) as reporter.\n$book-\u003ecreateReport([1, 2], 'some message', $user');\n\n$book-\u003ereports(); // HasMany relation to reports of book.\n$book-\u003ereports; // Collection of book's reports.\n\n$book-\u003eisReported() // check if current logged in user form default guard has reported book.\n$book-\u003eisReported // check if current logged in user form default guard has reported book.\n$book-\u003eisReported('api') // check if current logged in user form 'api' guard has reported book.\n$book-\u003eisReported($user) // check if '$user' has reported book.\n\n$book-\u003ereportsCount; // return number of reports on $book.\n$book-\u003ereportsCount(); // return number of reports on $book.\n```\n\nReport objects\n\n```php\n$report-\u003eassign(); // Assign current logged from default guard as admin of $report\n$report-\u003eassign('api'); // Assign current logged from 'api' guard as admin of $report\n$report-\u003eassign($user); // Assign $user as admin of $report\n\n// set resolved_at with current timestamp and assign current logged from default guard as admin of $report\n$report-\u003eresolve();\n\n// set resolved_at with current timestamp and assign current logged from 'api' guard as admin of $report\n$report-\u003eresolve('api');\n\n// set resolved_at with current timestamp and assign $user as admin of $report\n$report-\u003eresolve($user);\n\n// check if $report is resolved or not.\n$report-\u003eisResolved();\n```\n\n#### Credits\n\n - Mohammad Nourinik - http://inpinapp.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finpin%2Flara-report","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finpin%2Flara-report","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finpin%2Flara-report/lists"}