1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/guanguans-laravel-soar

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
QueryBuilderMixin.php 1.8 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
guanguans Отправлено 13.05.2025 00:25 b484aa6
<?php
/** @noinspection DebugFunctionUsageInspection */
/** @noinspection ForgottenDebugOutputInspection */
/** @noinspection PhpParamsInspection */
/** @noinspection PhpUnused */
declare(strict_types=1);
/**
* Copyright (c) 2020-2025 guanguans<ityaozm@gmail.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://github.com/guanguans/laravel-soar
*/
namespace Guanguans\LaravelSoar\Mixins;
use Guanguans\LaravelSoar\Facades\Soar;
use Guanguans\LaravelSoar\Support\Utils;
/**
* @mixin \Illuminate\Database\Eloquent\Builder
* @mixin \Illuminate\Database\Eloquent\Relations\Relation
* @mixin \Illuminate\Database\Query\Builder
*/
class QueryBuilderMixin
{
public function ddSoarScore(): \Closure
{
return fn (int $depth = 512, int $options = 0): mixed => dd($this->toSoarScore($depth, $options)); // @codeCoverageIgnore
}
public function dumpSoarScore(): \Closure
{
return function (int $depth = 512, int $options = 0): self {
dump($this->toSoarScore($depth, $options));
return $this;
};
}
public function toSoarScore(): \Closure
{
return fn (int $depth = 512, int $options = 0): array => Soar::arrayScores(
$this->toRawSql(),
$depth,
$options
)[0];
}
public function ddRawSql(): \Closure
{
return fn (): mixed => dd($this->toRawSql()); // @codeCoverageIgnore
}
public function dumpRawSql(): \Closure
{
return function (): self {
dump($this->toRawSql());
return $this;
};
}
public function toRawSql(): \Closure
{
return fn (): string => Utils::toRawSql($this);
}
}

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/guanguans-laravel-soar.git
git@api.gitlife.ru:oschina-mirror/guanguans-laravel-soar.git
oschina-mirror
guanguans-laravel-soar
guanguans-laravel-soar
master