Skip to content

Latest commit

 

History

History
49 lines (40 loc) · 815 Bytes

README.md

File metadata and controls

49 lines (40 loc) · 815 Bytes

Eloquent Dumper

Install

composer install

composer require recca0120/eloquent-dumper

publish config

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

// eloquent-dumper.php
return [
    /*
     * Supported: "pdo", "mysql", "sqlite", "pgsql", "sqlsrv"
     */
    'driver' => env('ELOQUENT_DUMPER_GRAMMAR', 'pdo'),
];

How to use

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'