Add model to blocklist/allowlist,
Install the package via composer:
composer require think.studio/laravel-blocklist-check
Optionally you can publish the config file with:
php artisan vendor:publish --provider="LaraBlockList\ServiceProvider" --tag="config"
Update your model:
use LaraBlockList\Contracts\CanBeInBlocklist;
use LaraBlockList\Models\HasBlocklist;
class User /* ... */ implements CanBeInBlocklist
{
use HasBlocklist;
/**
* @inheritDoc
*/
public function getBlocklistProcessor(array $args = []): BlocklistProcessor
{
return new BlocklistProcessor([
new RegexChecker([ '/\.ru$/', ], [ 'email' ]),
new RegexChecker([ /* contain cyrillic */ '/[А-Яа-яЁё]+/u', ], [ 'name', ]),
]);
}
// ...
}
Now you can run checks:
php artisan blocklist:check "\App\Models\User"
# or
php artisan blocklist:check "\App\Models\User" 123
# or
php artisan blocklist:check "\App\Models\User" --from=2020-01-01 --queue=default