uteq/laravel-query-builder-macros

A set of common Laravel Uteq helpers and macros
1,536 20
Install
composer require uteq/laravel-query-builder-macros
Latest Version:1.0.8
PHP:^8.0
License:MIT
Last Updated:Mar 26, 2023
Links: GitHub  ·  Packagist
Maintainer: uteq

A set of useful macros for the query builder

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

Adds useful functionality to the Laravel Query Builder Illuminate\Database\Query\Builder.

Installation

composer require uteq/laravel-query-builder-macros

Or add the Uteq Laravel Support package

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

Inspiration by

Building this package I got inspired by the following:

Credits

Testing

$ composer test

About Uteq

We are a web development agency based in the Netherlands. We design and build web applications for our clients. We are specialized in Laravel with Livewire.

License

The MIT License (MIT). Please see License File for more information.

Related Packages

uteq/laravel-move

Laravel admin panel powered by Livewire and Jetstream

208 8
uteq/laravel-support

A set of common Laravel Uteq helpers and macros

1,494 0
doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

637,827,751 9,703
laravel/framework

The Laravel Framework.

589,172,971 34,950
laravel/tinker

Powerful REPL for the Laravel framework.

498,216,183 7,442