uteq / laravel-query-builder-macros
一组常见的 Laravel Uteq 辅助函数和宏
1.0.8
2023-03-26 08:28 UTC
Requires
- php: ^8.0
- illuminate/support: ^8.71|^9.0|^10.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.9
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^8.0
- pestphp/pest: ^2.0
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- spatie/laravel-ray: ^1.26
README
为 Laravel 查询构建器 Illuminate\Database\Query\Builder 添加有用功能。
安装
composer require uteq/laravel-query-builder-macros
或者添加 Uteq Laravel 支持包
composer require uteq/laravel-support
rawQuery
$rawQuery = Account::query() ->where('email', 'john') ->getQuery() // You need to do this to get the rawQuery ->rawQuery(); // return `select * from "account" where "email" = 'john'`
ddQuery
Account::query() ->where('email', 'john') ->ddQuery(); // dd() of `select * from "account" where "email" = 'john'`
dumpQuery
Account::query() ->where('email', 'john') ->dumpQuery(); // dump() of `select * from "account" where "email" = 'john'` // the execution of the script will continue
rayQuery
Account::query() ->where('email', 'john') ->rayQuery(); // ray() of `select * from "account" where "email" = 'john'` // the execution of the script will continue
灵感来源
在构建这个包的过程中,我受到了以下启发:
- https://stackoverflow.com/a/53337416
- http://github.com/spatie/laravel-collection-macros
- https://github.com/spatie/package-skeleton-laravel
致谢
测试
$ composer test
关于 Uteq
我们是荷兰的一家网络开发公司。我们为客户设计和构建网络应用程序。我们专注于 Laravel 和 Livewire。
许可
MIT 许可证(MIT)。请参阅 许可文件 获取更多信息。