Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/recca0120/eloquent-dumper
dump eloquent raw sql
https://github.com/recca0120/eloquent-dumper
dump eloquent laravel raw sql
Last synced: 3 months ago
JSON representation
dump eloquent raw sql
- Host: GitHub
- URL: https://github.com/recca0120/eloquent-dumper
- Owner: recca0120
- License: mit
- Created: 2020-04-28T09:11:19.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-03-12T21:01:26.000Z (11 months ago)
- Last Synced: 2024-10-20T08:03:44.114Z (4 months ago)
- Topics: dump, eloquent, laravel, raw, sql
- Language: PHP
- Homepage:
- Size: 68.4 KB
- Stars: 30
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Eloquent Dumper
## Install
composer install
```bash
composer require recca0120/eloquent-dumper
```publish config
```bash
php artisan vendor:publish --tag="eloquent-dumper"
```## Config
when you use sqlite in PHPUnit and you need MySQL version sql, you can set driver to mysql, it will output MySQL version sql
```php
// eloquent-dumper.php
return [
/*
* Supported: "pdo", "mysql", "sqlite", "pgsql", "sqlsrv"
*/
'driver' => env('ELOQUENT_DUMPER_GRAMMAR', 'pdo'),
];
```
## How to use```php
var_dump(
User::where('name', 'foo')
->where('password', 'bar')
->sql()
);User::where('name', 'foo')
->where('password', 'bar')
->dumpSql()
->get();// output:
// SELECT
// *
// FROM
// `users`
// WHERE
// `name` = 'foo' AND `password` = 'bar'
```