Adds useful functionality to the Laravel Query Builder
Illuminate\Database\Query\Builder
.
composer require uteq/laravel-query-builder-macros
Or add the Uteq Laravel Support package
composer require uteq/laravel-support
$rawQuery = Account::query()
->where('email', 'john')
->getQuery() // You need to do this to get the rawQuery
->rawQuery();
// return `select * from "account" where "email" = 'john'`
Account::query()
->where('email', 'john')
->ddQuery();
// dd() of `select * from "account" where "email" = 'john'`
Account::query()
->where('email', 'john')
->dumpQuery();
// dump() of `select * from "account" where "email" = 'john'`
// the execution of the script will continue
Account::query()
->where('email', 'john')
->rayQuery();
// ray() of `select * from "account" where "email" = 'john'`
// the execution of the script will continue
Building this package I got inspired by the following:
- https://stackoverflow.com/a/53337416
- http://github.com/spatie/laravel-collection-macros
- https://github.com/spatie/package-skeleton-laravel
$ composer test
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.
The MIT License (MIT). Please see License File for more information.