{"id":40940147,"url":"https://github.com/2177866/reporting","last_synced_at":"2026-01-22T04:33:30.862Z","repository":{"id":271594129,"uuid":"913945793","full_name":"2177866/reporting","owner":"2177866","description":"Laravel Complaint \u0026 Note Manager","archived":false,"fork":false,"pushed_at":"2025-04-09T23:24:38.000Z","size":177,"stargazers_count":0,"open_issues_count":9,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-13T13:48:02.616Z","etag":null,"topics":["complaints","laravel-package","notes","polymorphic-relationships","reports"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/alyakin/reporting","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/2177866.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-08T16:47:32.000Z","updated_at":"2025-04-09T23:22:57.000Z","dependencies_parsed_at":"2025-01-08T18:26:24.543Z","dependency_job_id":"87b4617a-193c-4281-b751-e2daa5809b89","html_url":"https://github.com/2177866/reporting","commit_stats":null,"previous_names":["2177866/reporting"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/2177866/reporting","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2177866%2Freporting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2177866%2Freporting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2177866%2Freporting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2177866%2Freporting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/2177866","download_url":"https://codeload.github.com/2177866/reporting/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2177866%2Freporting/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28654723,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["complaints","laravel-package","notes","polymorphic-relationships","reports"],"created_at":"2026-01-22T04:33:30.366Z","updated_at":"2026-01-22T04:33:30.853Z","avatar_url":"https://github.com/2177866.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Laravel Complaint \u0026 Note Manager\n\n[![Packagist Version](https://img.shields.io/packagist/v/alyakin/reporting)](https://packagist.org/packages/alyakin/reporting)\n[![Downloads](https://img.shields.io/packagist/dt/alyakin/reporting)](https://packagist.org/packages/alyakin/reporting)\n![Laravel 9+](https://img.shields.io/badge/Laravel-10%2B-orange)\n![PHP 8+](https://img.shields.io/badge/PHP-8%2B-blue)\n[![MIT License](https://img.shields.io/badge/license-MIT-green)](LICENCE)\n\n[![PHPUnit](https://github.com/2177866/reporting/actions/workflows/phpunit.yml/badge.svg)](https://github.com/2177866/reporting/actions/workflows/phpunit.yml)\n[![Laravel Pint](https://github.com/2177866/reporting/actions/workflows/pint.yml/badge.svg)](https://github.com/2177866/reporting/actions/workflows/pint.yml)\n[![Larastan](https://github.com/2177866/reporting/actions/workflows/larastan.yml/badge.svg)](https://github.com/2177866/reporting/actions/workflows/larastan.yml)\n![Larastan Level](https://img.shields.io/badge/Larastan-level%209-blueviolet)\n\n**Laravel Complaint \u0026 Note Manager** is a package for managing complaints, notes, and similar entities in Laravel projects. It uses polymorphic relationships for integration with any models.\n\nIdeal for social networks, e-commerce, and content moderation projects that require collecting and managing user complaints, reports, or note ([use cases](#use-cases)).\n\n### Features:\n- **Polymorphic Relationships**: Easy integration with different models.\n- **Metadata**: Ability to save additional data.\n- **Automatic Deletion**: Manage outdated records.\n- **Customization**: Configure through configuration files and migrations.\n\n## Table of Contents\n\n1. [Laravel Complaint \u0026 Note Manager](#laravel-complaint--note-manager)\n2. [Installation](#installation)\n   - [Requirements ](#requirements)\n   - [Step 1: Install via Composer](#step-1-install-via-composer)\n   - [Step 2: Publish Configuration and Migrations](#step-2-publish-configuration-and-migrations)\n3. [Configuration](#configuration)\n   - [Basic Settings](#basic-settings)\n   - [Customizing the Complaint Model](#customizing-the-complaint-model)\n4. [Usage](#usage)\n   - [Adding the Reportable Trait](#adding-the-reportable-trait)\n   - [Creating a Complaint](#creating-a-complaint)\n   - [Retrieving Complaints](#retrieving-complaints)\n   - [Deleting a Complaint](#deleting-a-complaint)\n5. [Automatic Deletion of Old Complaints](#automatic-deletion-of-old-complaints)\n   - [Scheduler Configuration](#scheduler-configuration)\n   - [Manual Deletion](#manual-deletion)\n6. [Use cases](#use-cases)\n7. [Testing](#testing)\n8. [Want to Contribute?](#want-to-contribute)\n9. [License](#license)\n\n\n## Installation\n\n### Requirements\n\n- PHP ^8.0\n- Laravel ^9.0, ^10.0, ^11.0\n\n### Step 1: Install via Composer\n\n```bash\ncomposer require alyakin/reporting\n```\n\n### Step 2: Publish Configuration and Migrations\n```bash\nphp artisan vendor:publish --provider=\"Alyakin\\Reporting\\ReportingServiceProvider\"\nphp artisan migrate\n```\n\nEnsure that your database settings are correct before running migrations.\n\n\n## Configuration\n\nAfter installing the module, the configuration file is available at `config/reporting.php`. If the file is missing, run the following command:\n\n```bash\nphp artisan vendor:publish --provider=\"Alyakin\\Reporting\\ReportingServiceProvider\" --tag=config\n```\n\n### Basic Settings\n\nExample configuration file content:\n\n```php\nreturn [\n    'report_model' =\u003e \\Alyakin\\Reporting\\Models\\Report::class,\n    'soft_delete_days' =\u003e 30,\n];\n```\n\n### Customizing the Complaint Model\n\nIf you need to extend the default model, update the `report_model` parameter in the configuration:\n\n```php\n'report_model' =\u003e \\App\\Models\\CustomReport::class,\n```\n\nThe model must extend `Alyakin\\Reporting\\Models\\Report`:\n\n```php\nnamespace App\\Models;\n\nuse Alyakin\\Reporting\\Models\\Report;\n\nclass CustomReport extends Report\n{\n    // Your additional methods or fields\n}\n```\n\n## Usage\n\n### Adding the `Reportable` Trait\n\nAdd the `Reportable` trait to any model that should support complaints:\n\n```php\nuse Alyakin\\Reporting\\Traits\\Reportable;\n\nclass Post extends Model\n{\n    use Reportable;\n}\n```\n\n### Creating a Complaint\n\nUse the `reports()` relationship to create a complaint:\n\n```php\n$post = Post::find(1);\n$user = $request-\u003euser();\n\n$report = $post-\u003eaddReport([\n    'reason' =\u003e 'Спам',\n    'meta' =\u003e ['severity' =\u003e 'низкий'],\n], $user-\u003eid);\n```\n\n### Retrieving Complaints\n\nRetrieve all complaints for a model:\n\n```php\n$reports = $post-\u003ereports;\n```\n\nRetrieve the related model from a complaint:\n\n```php\n$post = $report-\u003ereportable;\n```\n\n### Deleting a Complaint\n\nDelete a complaint using standard Eloquent methods:\n\n```php\n$report-\u003edelete();\n```\n\n## Automatic Deletion of Old Complaints\n\nOld complaints are deleted based on the `soft_delete_days` parameter in the configuration (default is 30 days).\n\n### Scheduler Configuration\n\nAdd the following line to `app/Console/Kernel.php`:\n\n```php\n$schedule-\u003ecommand('model:prune')-\u003edaily();\n```\n\n### Manual Deletion\n\nRun the cleanup process manually:\n\n```bash\nphp artisan model:prune\n```\n\n## Use Cases\n\nHere are five different examples of how this package can be applied across various domains:\n\n1. **Social Networks:** Users can report posts or comments that violate guidelines...\n2. **E-commerce Platforms:** Customers can flag products or sellers...\n3. **Content Management Systems (CMS):** Readers can report offensive or incorrect content...\n4. **Customer Support Systems:** Users can submit complaints linked to their accounts or tickets...\n5. **Educational Platforms:** Students can report problems with course materials or instructors...\n\n## Testing\n\nThis package includes a test suite to ensure functionality works as expected. To run the tests:\n\n```bash\ncomposer test\n```\n\n### PHPUnit\n\nThe package uses PHPUnit for feature and unit tests. You can run PHPUnit tests specifically with:\n\n```bash\n./vendor/bin/phpunit\n```\n\n### Static Analysis\n\nWe use Larastan (PHPStan for Laravel) for static code analysis (with level 9):\n\n```bash\n./vendor/bin/phpstan analyse\n```\n\n### Code Style\n\nLaravel Pint is used for code style enforcement:\n\n```bash\n./vendor/bin/pint\n```\n\n## Want to Contribute?\n\nThis package is open for community contributions!\n\nYou can:\n- Explore the [open issues](https://github.com/2177866/reporting/issues) to see what's planned\n- Pick a task labeled [`good first issue`](https://github.com/2177866/reporting/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) or [`help wanted`](https://github.com/2177866/reporting/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)\n- Suggest a new feature or improvement by opening an issue\n- Fork the repository and submit a Pull Request\n\n### Contribution Requirements\n\nWhen contributing to this package, please ensure:\n\n1. **Code Style**: All code must follow our style guidelines. Run Laravel Pint before submitting:\n   ```bash\n   ./vendor/bin/pint\n   ```\n\n2. **Static Analysis**: Code must pass Larastan level 9 analysis:\n   ```bash\n   ./vendor/bin/phpstan analyse\n   ```\n\n3. **Test Coverage**: All new features or bug fixes must include tests.\n\n4. **Documentation**: Update the README.md and other documentation to reflect any changes in functionality.\n\n5. **Feature Branches**: Create a feature branch for your changes and submit a pull request against the main branch.\n\n### Current Roadmap Highlights\n\n- Add support for Laravel-style events (e.g. `ReportCreated`, `ReportDeleted`)\n- Artisan command to purge old reports (`reporting:purge`)\n\nWe welcome contributions, feedback, and ideas! 😊\n\n## License\n\nThis package is distributed under the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2177866%2Freporting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F2177866%2Freporting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2177866%2Freporting/lists"}