{"id":28633947,"url":"https://github.com/elegantengineeringtech/laravel-banhammer","last_synced_at":"2026-01-07T22:13:22.339Z","repository":{"id":293691541,"uuid":"982873374","full_name":"ElegantEngineeringTech/laravel-banhammer","owner":"ElegantEngineeringTech","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-10T12:22:33.000Z","size":48,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-22T19:58:01.890Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/ElegantEngineeringTech.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"ElegantEngineeringTech"}},"created_at":"2025-05-13T14:29:46.000Z","updated_at":"2025-09-10T12:22:31.000Z","dependencies_parsed_at":"2025-05-16T16:50:46.829Z","dependency_job_id":"22aa60cd-4f6e-48e9-a41a-25a9af46c8f2","html_url":"https://github.com/ElegantEngineeringTech/laravel-banhammer","commit_stats":null,"previous_names":["elegantengineeringtech/laravel-banhammer"],"tags_count":3,"template":false,"template_full_name":"spatie/package-skeleton-laravel","purl":"pkg:github/ElegantEngineeringTech/laravel-banhammer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElegantEngineeringTech%2Flaravel-banhammer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElegantEngineeringTech%2Flaravel-banhammer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElegantEngineeringTech%2Flaravel-banhammer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElegantEngineeringTech%2Flaravel-banhammer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ElegantEngineeringTech","download_url":"https://codeload.github.com/ElegantEngineeringTech/laravel-banhammer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElegantEngineeringTech%2Flaravel-banhammer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002054,"owners_count":26083286,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"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":[],"created_at":"2025-06-12T15:39:59.183Z","updated_at":"2025-10-09T21:34:21.317Z","avatar_url":"https://github.com/ElegantEngineeringTech.png","language":"PHP","funding_links":["https://github.com/sponsors/ElegantEngineeringTech"],"categories":[],"sub_categories":[],"readme":"# This is my package laravel-banhammer\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/elegantly/laravel-banhammer.svg?style=flat-square)](https://packagist.org/packages/elegantly/laravel-banhammer)\n[![Tests](https://img.shields.io/github/actions/workflow/status/ElegantEngineeringTech/laravel-banhammer/run-tests.yml?branch=main\u0026label=tests\u0026style=flat-square)](https://github.com/ElegantEngineeringTech/laravel-banhammer/actions?query=workflow%3Arun-tests+branch%3Amain)\n[![Code Style](https://img.shields.io/github/actions/workflow/status/ElegantEngineeringTech/laravel-banhammer/fix-php-code-style-issues.yml?branch=main\u0026label=code%20style\u0026style=flat-square)](https://github.com/ElegantEngineeringTech/laravel-banhammer/actions?query=workflow%3A\"Fix+PHP+code+style+issues\"+branch%3Amain)\n[![PHPStan Level](https://img.shields.io/github/actions/workflow/status/ElegantEngineeringTech/laravel-banhammer/phpstan.yml?label=phpstan\u0026style=flat-square)](https://github.com/ElegantEngineeringTech/laravel-banhammer/actions?query=workflow%3Aphpstan)\n[![Laravel Pint](https://img.shields.io/github/actions/workflow/status/ElegantEngineeringTech/laravel-banhammer/pint.yml?label=laravel%20pint\u0026style=flat-square)](https://github.com/ElegantEngineeringTech/laravel-banhammer/actions?query=workflow%3Apint)\n[![Total Downloads](https://img.shields.io/packagist/dt/elegantly/laravel-banhammer.svg?style=flat-square)](https://packagist.org/packages/elegantly/laravel-banhammer)\n\nA simple package to ban an model (users, teams...).\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require elegantly/laravel-banhammer\n```\n\nFirst, publish the config with:\n\n```bash\nphp artisan vendor:publish --tag=\"banhammer-config\"\n```\n\nThen define the bannable models in the config file like this:\n\n```php\nuse Elegantly\\Banhammer\\Models\\Ban;\nuse Illuminate\\Foundation\\Auth\\User;\n\nreturn [\n\n    'model_ban' =\u003e Ban::class,\n\n    'model_user' =\u003e User::class,\n\n    'bannables' =\u003e [\n        \\App\\Models\\User::class,\n        // \\App\\Models\\Team::class\n    ],\n\n];\n\n```\n\nNext, publish and run the migrations with:\n\n```bash\nphp artisan vendor:publish --tag=\"banhammer-migrations\"\nphp artisan migrate\n```\n\nFinally schedule the command from `bootstrap/app.php` with:\n\n```php\nuse Illuminate\\Foundation\\Application;\nuse Illuminate\\Console\\Scheduling\\Schedule;\nuse Elegantly\\Banhammer\\Commands\\DenormalizeBannableCommand;\n\nreturn Application::configure(basePath: dirname(__DIR__))\n    // ...\n    -\u003ewithSchedule(function (Schedule $schedule) {\n        $schedule-\u003ecommand(DenormalizeBannableCommand::class)-\u003eeveryMinute();\n    })\n    -\u003ecreate();\n```\n\nOr from `routes/console.php` with:\n\n```php\nuse Illuminate\\Support\\Facades\\Schedule;\nuse Elegantly\\Banhammer\\Commands\\DenormalizeBannableCommand;\n\nSchedule::command(DenormalizeBannableCommand::class)-\u003eeveryMinute();\n```\n\n## Usage\n\n### Prepare your models:\n\n```php\nnamespace App\\Models;\n\nuse Elegantly\\Banhammer\\Models\\Concerns\\Bannable;\nuse Elegantly\\Banhammer\\Models\\Contracts\\BannableContract;\nuse Illuminate\\Foundation\\Auth\\User as Authenticatable;\n\nclass User extends Authenticatable implements BannableContract\n{\n    use Bannable;\n}\n```\n\n```php\n$user-\u003eban(\n    level: 0,\n    reason: \"spam\",\n    from: now(),\n    until: null,\n);\n```\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n-   [Quentin Gabriele](https://github.com/QuentinGab)\n-   [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felegantengineeringtech%2Flaravel-banhammer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felegantengineeringtech%2Flaravel-banhammer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felegantengineeringtech%2Flaravel-banhammer/lists"}