thtg88 / laravel-exists-without-soft-deleted-rule
提供 Laravel `exists` 验证规则,排除软删除的模型。
v0.3.0
2021-01-16 20:09 UTC
Requires
- illuminate/container: ^7.0.0 || ^8.0.0
- illuminate/contracts: ^7.0.0 || ^8.0.0
- illuminate/support: ^7.0.0 || ^8.0.0
- illuminate/validation: ^7.0.0 || ^8.0.0
Requires (Dev)
- brainmaestro/composer-git-hooks: ^2.8
- friendsofphp/php-cs-fixer: ^2.16
- fzaninotto/faker: ^1.9
- orchestra/testbench: ^5.1
- phpstan/phpstan: ^0.12.14
- phpunit/phpunit: ^8.1
This package is auto-updated.
Last update: 2024-09-26 18:38:32 UTC
README
我的大多数应用程序都使用了具有 SoftDeletes
特性的模型。
因此,在所有我的验证规则中,我总是需要为 exists
验证规则指定额外的 whereNull
语句。
该包提供了一个快捷的 exists_without_soft_deleted
规则。
目录
安装
composer require thtg88/laravel-exists-without-soft-deleted-rule
您可以通过运行以下命令发布配置文件和视图:
php artisan vendor:publish --provider="Thtg88\ExistsWithoutSoftDeletedRule\ExistsWithoutSoftDeletedRuleServiceProvider"
使用方法
Laravel Exists Without Soft Deleted Validation Rule 提供了一个验证规则,用于检查模型的存在性,但不包括软删除的模型。
验证规则
该验证规则通过 exists_without_soft_deleted
提供。
例如,如果您正在验证 users
表上的 name
属性,则可以使用此规则
'name' => 'exists_without_soft_deleted:users',
其他使用示例与 Laravel 的 exists
规则类似。
有关更多信息,请参阅 官方 Laravel 文档
许可证
Laravel Exists Without Soft Deleted Validation Rule 是开源软件,许可证为 MIT 许可证。
安全漏洞
如果您在 Laravel Exists Without Soft Deleted Validation Rule 中发现安全漏洞,请发送电子邮件至 security@marco-marassi.com。所有安全漏洞都将得到及时处理。