easoblue / larahelper
Laravel 辅助工具。
1.0.1
2022-11-28 11:11 UTC
Requires
- php: ^7.2|^8.0
- illuminate/support: ^5.8|^6.0|^7.0|^8.0|^9.0
Requires (Dev)
- orchestra/testbench: ^4.0
- phpunit/phpunit: ^8.0
README
安装
您可以通过 composer 安装此包。
composer require easoblue/larahelper
用法
您可以添加别名以简化或直接导入 LaraHelper 门面。
use Easoblue\LaraHelper\Facade\LaraHelper;
准备就绪后,您可以使用 generateString 方法生成随机或唯一的字符串。您可以通过传递参数来生成特定类型的字符串。
LaraHelper::generateString('alpha');
您可以使用 checkUnique 与 generateString、表名和列名一起使用,以验证唯一字符串。
LaraHelper::checkUnique('users','username')->generateString('alpha');
LaraHelper::checkUnique('users','username')->generateString('alpha'); LaraHelper::checkUnique('users','username')->prefix('u_')->postfix('u_')->generateString('alpha'); // prefix will be prepended to the generated string before checking unique. Same as postfix will be appended to the generated string before checking unique. // This method will format the error response and return the object with single validation error instead of array. // $validator is the intance of Illuminate\Validation\Validator class; if($validator->fails()){ return LaraHelper::formatValidatorError($validator); } LaraHelper::formatToCamelCase('format to camel case');
测试
待添加。
完整文档
完整的文档将在 doc.easoblue.com 上提供。
变更日志
请参阅 CHANGELOG 了解最近的变化。
贡献
请参阅 CONTRIBUTING 了解详情。
安全
如果您发现任何安全相关的问题,请通过电子邮件 issues@easoblue.com 联系,而不是使用问题跟踪器。
鸣谢
许可证
MIT 许可证(MIT)。请参阅 许可证文件 了解更多信息。