uteq/laravel-query-builder-macros

一组常见的 Laravel Uteq 辅助函数和宏

1.0.8 2023-03-26 08:28 UTC

This package is auto-updated.

Last update: 2024-09-26 12:24:17 UTC


README

Latest Version on Packagist Run tests Check & fix styling Total Downloads

为 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

灵感来源

在构建这个包的过程中,我受到了以下启发:

致谢

测试

$ composer test

关于 Uteq

我们是荷兰的一家网络开发公司。我们为客户设计和构建网络应用程序。我们专注于 Laravel 和 Livewire。

许可

MIT 许可证(MIT)。请参阅 许可文件 获取更多信息。