Looking to hire Laravel developers? Try LaraJobs

laravel-query-builder-macros maintained by uteq

Description
A set of common Laravel Uteq helpers and macros
Author
Last update
2023/03/26 11:06 (dev-main)
License
Downloads
1 527

Comments
comments powered by Disqus

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.