[
  {
    "path": ".editorconfig",
    "content": "root = true\n\n[*]\ncharset = utf-8\nend_of_line = lf\ninsert_final_newline = true\nindent_style = space\nindent_size = 4\ntrim_trailing_whitespace = true\n\n[*.md]\ntrim_trailing_whitespace = false\n\n[*.yml]\nindent_size = 2\n"
  },
  {
    "path": ".gitattributes",
    "content": "* text=auto\n\n/.github            export-ignore\n/doc                export-ignore\n/tests              export-ignore\n.editorconfig       export-ignore\n.gitattributes      export-ignore\n.gitignore          export-ignore\nphpunit.xml.dist    export-ignore\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/1_Bug_Report.md",
    "content": "---\nname: \"🐞 Bug Report\"\nabout: 'If you want to report an issue.'\n---\n\n### Versions:\n\n- Package Version: #.#.#\n- PHP Version: #.#.#\n\n### Description:\n\n...\n\n### Steps to reproduce:\n\n...\n\n#### Expected:\n\n...\n\n#### Actual:\n\n...\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/2_Feature_Request.md",
    "content": "---\nname: \"💡 Feature Request\"\nabout: 'If you want to propose an idea.'\n---\n\n### Description:\n\n...\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/3_Laravel_Version_Support.md",
    "content": "---\nname: \"🛠 Laravel Version Support\"\nabout: 'If you want to support a new Laravel version.'\n---\n\n<!-- Here's how to support a new Laravel version. Thanks for your help! 👍 -->\n\n### Follow these steps:\n\n> Please, note that we have to update versions for everything, not only `illuminate` packages.\n\n1. Update versions in `composer.json` according to Laravel's `composer.json`.\n2. Add the newly supported version to `README.md`.\n3. Open PR to the `master` branch.\n"
  },
  {
    "path": ".github/PULL_REQUEST_TEMPLATE.md",
    "content": "<!--\nPlease, provide a descriptive title, thorough description, and tests for your PR.\n\nAlso, make sure that all CI checks have passed: Code Style, Tests, Tests Coverage, etc.\n-->\n"
  },
  {
    "path": ".github/workflows/tests.yml",
    "content": "name: tests\n\non: [push, pull_request]\n\njobs:\n  tests:\n    runs-on: ubuntu-latest\n    strategy:\n      fail-fast: false\n      matrix:\n        php: [8.2, 8.3, 8.4]\n        stability: [prefer-lowest, prefer-stable]\n\n    name: PHP ${{ matrix.php }} / ${{ matrix.stability }}\n\n    steps:\n      - name: Checkout code\n        uses: actions/checkout@v4\n\n      - name: Setup PHP\n        uses: shivammathur/setup-php@v2\n        with:\n          php-version: ${{ matrix.php }}\n          extensions: sqlite3\n          tools: composer:v2\n          coverage: xdebug\n\n      - name: Setup problem matchers\n        run: |\n          echo \"::add-matcher::${{ runner.tool_cache }}/php.json\"\n          echo \"::add-matcher::${{ runner.tool_cache }}/phpunit.json\"\n\n      - name: Install dependencies\n        uses: nick-invision/retry@v2\n        with:\n          timeout_minutes: 5\n          max_attempts: 5\n          command: composer update --prefer-dist --${{ matrix.stability }} --no-interaction --no-progress --ansi\n\n      - name: Run tests\n        run: vendor/bin/phpunit --colors=always --coverage-clover ./build/logs/clover.xml\n\n      - name: Code coverage\n        uses: codecov/codecov-action@v3\n        with:\n          token: ${{ secrets.CODECOV_TOKEN }}\n          files: ./build/logs/clover.xml\n          fail_ci_if_error: true\n"
  },
  {
    "path": ".gitignore",
    "content": "/.idea\n/.phpunit.cache\n/.vscode\n/vendor\n.DS_Store\n.phpunit.result.cache\nThumbs.db\ncomposer.lock\ncomposer.phar\nphpunit.xml\n"
  },
  {
    "path": "LICENSE.md",
    "content": "The MIT License (MIT)\n\nCopyright (c) Dmitry Ivanov\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "![Database Profiler for Laravel Web and Console Applications](art/1380x575-optimized.jpg)\n\n# Laravel Database Profiler\n\n[<img src=\"https://user-images.githubusercontent.com/1286821/181085373-12eee197-187a-4438-90fe-571ac6d68900.png\" alt=\"Buy me a coffee\" width=\"200\" />](https://buymeacoffee.com/dmitry.ivanov)\n\n[![StyleCI](https://github.styleci.io/repos/68023936/shield?branch=master&style=flat)](https://github.styleci.io/repos/68023936?branch=master)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/dmitry-ivanov/laravel-db-profiler/tests.yml?branch=master)](https://github.com/dmitry-ivanov/laravel-db-profiler/actions?query=workflow%3Atests+branch%3Amaster)\n[![Coverage Status](https://img.shields.io/codecov/c/github/dmitry-ivanov/laravel-db-profiler/master)](https://app.codecov.io/gh/dmitry-ivanov/laravel-db-profiler/tree/master)\n\n![Packagist Version](https://img.shields.io/packagist/v/illuminated/db-profiler)\n![Packagist Stars](https://img.shields.io/packagist/stars/illuminated/db-profiler)\n![Packagist Downloads](https://img.shields.io/packagist/dt/illuminated/db-profiler)\n![Packagist License](https://img.shields.io/packagist/l/illuminated/db-profiler)\n\nDatabase Profiler for Laravel Web and Console Applications.\n\n> A simple tool that works correctly even with `dd()` in your code.\n\n| Laravel | Database Profiler                                                      |\n|---------|------------------------------------------------------------------------|\n| 12.x    | [12.x](https://github.com/dmitry-ivanov/laravel-db-profiler/tree/12.x) |\n| 11.x    | [11.x](https://github.com/dmitry-ivanov/laravel-db-profiler/tree/11.x) |\n| 10.x    | [10.x](https://github.com/dmitry-ivanov/laravel-db-profiler/tree/10.x) |\n| 9.x     | [9.x](https://github.com/dmitry-ivanov/laravel-db-profiler/tree/9.x)   |\n| 8.x     | [8.x](https://github.com/dmitry-ivanov/laravel-db-profiler/tree/8.x)   |\n| 7.x     | [7.x](https://github.com/dmitry-ivanov/laravel-db-profiler/tree/7.x)   |\n| 6.x     | [6.x](https://github.com/dmitry-ivanov/laravel-db-profiler/tree/6.x)   |\n| 5.8.*   | [5.8.*](https://github.com/dmitry-ivanov/laravel-db-profiler/tree/5.8) |\n| 5.7.*   | [5.7.*](https://github.com/dmitry-ivanov/laravel-db-profiler/tree/5.7) |\n| 5.6.*   | [5.6.*](https://github.com/dmitry-ivanov/laravel-db-profiler/tree/5.6) |\n| 5.5.*   | [5.5.*](https://github.com/dmitry-ivanov/laravel-db-profiler/tree/5.5) |\n| 5.4.*   | [5.4.*](https://github.com/dmitry-ivanov/laravel-db-profiler/tree/5.4) |\n| 5.3.*   | [5.3.*](https://github.com/dmitry-ivanov/laravel-db-profiler/tree/5.3) |\n| 5.2.*   | [5.2.*](https://github.com/dmitry-ivanov/laravel-db-profiler/tree/5.2) |\n| 5.1.*   | [5.1.*](https://github.com/dmitry-ivanov/laravel-db-profiler/tree/5.1) |\n\n## Usage\n\n1. Install the package via Composer:\n\n    ```shell script\n    composer require illuminated/db-profiler\n    ```\n\n2. Use the `vvv` parameter for Web:\n\n    ![Laravel Database Profiler - Demo - Web](doc/img/demo-web-c.gif)\n\n3. Use the `-vvv` option for Console:\n\n    ![Laravel Database Profiler - Demo - Console](doc/img/demo-console.gif)\n\n## Local by default\n\nEnabled only for the `local` environment, so you don't have to worry about `production`.\n\nIf you want to force profiling for non-local environments - specify it explicitly in your `.env` file:\n\n> DB_PROFILER_FORCE=true\n\n## Sponsors\n\n[![Laravel Idea](art/sponsor-laravel-idea.png)](https://laravel-idea.com)<br>\n[![Material Theme UI Plugin](art/sponsor-material-theme.png)](https://material-theme.com)<br>\n\n## License\n\nLaravel Database Profiler is open-sourced software licensed under the [MIT license](LICENSE.md).\n\n[<img src=\"https://user-images.githubusercontent.com/1286821/181085373-12eee197-187a-4438-90fe-571ac6d68900.png\" alt=\"Buy me a coffee\" width=\"200\" />](https://buymeacoffee.com/dmitry.ivanov)&nbsp;\n"
  },
  {
    "path": "composer.json",
    "content": "{\n    \"name\": \"illuminated/db-profiler\",\n    \"description\": \"Database Profiler for Laravel Web and Console Applications.\",\n    \"keywords\": [\"laravel\", \"db\", \"database\", \"profiler\", \"profiling\", \"query\", \"sql\", \"mysql\", \"web-profiling\", \"console-profiling\"],\n    \"license\": \"MIT\",\n    \"support\": {\n        \"issues\": \"https://github.com/dmitry-ivanov/laravel-db-profiler/issues\",\n        \"source\": \"https://github.com/dmitry-ivanov/laravel-db-profiler\"\n    },\n    \"authors\": [{\n        \"name\": \"Dmitry Ivanov\",\n        \"email\": \"dmitry.g.ivanov@gmail.com\"\n    }],\n    \"require\": {\n        \"php\": \"^8.2\",\n        \"illuminate/database\": \"^12.0\",\n        \"illuminate/support\": \"^12.0\"\n    },\n    \"require-dev\": {\n        \"phpunit/phpunit\": \"^11.5.3\",\n        \"mockery/mockery\": \"^1.6.10\",\n        \"orchestra/testbench\": \"^10.0\",\n        \"illuminated/testing-tools\": \"^12.0\",\n        \"illuminated/helper-functions\": \"^12.0\"\n    },\n    \"autoload\": {\n        \"psr-4\": {\n            \"Illuminated\\\\Database\\\\\": \"src/\"\n        }\n    },\n    \"autoload-dev\": {\n        \"psr-4\": {\n            \"Illuminated\\\\Database\\\\Tests\\\\\": \"tests/\",\n            \"Illuminated\\\\Database\\\\Tests\\\\App\\\\\": \"tests/fixture/app/\"\n        }\n    },\n    \"extra\": {\n        \"laravel\": {\n            \"providers\": [\n                \"Illuminated\\\\Database\\\\DbProfilerServiceProvider\"\n            ]\n        }\n    },\n    \"config\": {\n        \"sort-packages\": true\n    },\n    \"minimum-stability\": \"dev\",\n    \"prefer-stable\": true\n}\n"
  },
  {
    "path": "config/db-profiler.php",
    "content": "<?php\n\nreturn [\n\n    /*\n    |--------------------------------------------------------------------------\n    | Force Profiling\n    |--------------------------------------------------------------------------\n    |\n    | If you want to enable profiling for non-local environments,\n    | you should set this config variable to the `true` value,\n    | by using the `DB_PROFILER_FORCE` in your `.env` file.\n    |\n    */\n\n    'force' => env('DB_PROFILER_FORCE', false),\n\n];\n"
  },
  {
    "path": "phpunit.xml.dist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<phpunit xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"https://schema.phpunit.de/11.3/phpunit.xsd\"\n    beStrictAboutTestsThatDoNotTestAnything=\"false\"\n    beStrictAboutOutputDuringTests=\"true\"\n    bootstrap=\"vendor/autoload.php\"\n    colors=\"true\"\n    displayDetailsOnPhpunitDeprecations=\"true\"\n    displayDetailsOnTestsThatTriggerErrors=\"true\"\n    displayDetailsOnTestsThatTriggerNotices=\"true\"\n    displayDetailsOnTestsThatTriggerWarnings=\"true\"\n>\n    <testsuites>\n        <testsuite name=\"Laravel DB Profiler Test Suite\">\n            <directory>./tests</directory>\n        </testsuite>\n    </testsuites>\n\n    <source>\n        <include>\n            <directory>./src</directory>\n        </include>\n\n        <exclude>\n            <file>./src/DbProfilerDumper.php</file>\n        </exclude>\n    </source>\n</phpunit>\n"
  },
  {
    "path": "src/DbProfilerDumper.php",
    "content": "<?php\n\nnamespace Illuminated\\Database;\n\nclass DbProfilerDumper\n{\n    /**\n     * Dump the given query.\n     */\n    public function dump(string $query): void\n    {\n        /** @noinspection ForgottenDebugOutputInspection */\n        dump($query);\n    }\n}\n"
  },
  {
    "path": "src/DbProfilerServiceProvider.php",
    "content": "<?php\n\nnamespace Illuminated\\Database;\n\nuse Illuminate\\Database\\Events\\QueryExecuted;\nuse Illuminate\\Support\\Facades\\DB;\nuse Illuminate\\Support\\Facades\\Request;\nuse Illuminate\\Support\\ServiceProvider;\nuse Illuminate\\Support\\Str;\n\nclass DbProfilerServiceProvider extends ServiceProvider\n{\n    /**\n     * The query counter.\n     */\n    private int $counter = 1;\n\n    /**\n     * Register the service provider.\n     */\n    public function register(): void\n    {\n        $this->mergeConfigFrom(__DIR__.'/../config/db-profiler.php', 'db-profiler');\n\n        app()->instance('db.idpdumper', new DbProfilerDumper());\n    }\n\n    /**\n     * Boot the service provider.\n     */\n    public function boot(): void\n    {\n        if (!$this->isEnabled()) {\n            return;\n        }\n\n        DB::listen(function (QueryExecuted $query) {\n            $i = $this->counter++;\n            $sql = $this->applyQueryBindings($query->sql, $query->bindings);\n            $time = $query->time;\n            app('db.idpdumper')->dump(\"[{$i}]: {$sql}; ({$time} ms)\");\n        });\n    }\n\n    /**\n     * Check whether database profiling is enabled or not.\n     */\n    private function isEnabled(): bool\n    {\n        if (!$this->app->isLocal() && !config('db-profiler.force')) {\n            return false;\n        }\n\n        return $this->app->runningInConsole()\n            ? collect($_SERVER['argv'])->contains('-vvv')\n            : Request::exists('vvv');\n    }\n\n    /**\n     * Apply query bindings to the given SQL query.\n     */\n    private function applyQueryBindings(string $sql, array $bindings): string\n    {\n        $bindings = collect($bindings)->map(function ($binding) {\n            return match (gettype($binding)) {\n                'boolean' => (int) $binding,\n                'string' => \"'{$binding}'\",\n                default => $binding,\n            };\n        })->toArray();\n\n        return Str::replaceArray('?', $bindings, $sql);\n    }\n}\n"
  },
  {
    "path": "tests/ConsoleProfilingTest.php",
    "content": "<?php\n\nnamespace Illuminated\\Database\\Tests;\n\nuse PHPUnit\\Framework\\Attributes\\Test;\n\nclass ConsoleProfilingTest extends TestCase\n{\n    /**\n     * Define whether the app is running in console or not.\n     */\n    protected function runningInConsole(): bool\n    {\n        return true;\n    }\n\n    /**\n     * Emulate the \"vvv\" flag set.\n     */\n    protected function withVvv(): self\n    {\n        $_SERVER['argv']['-vvv'] = true;\n\n        return $this;\n    }\n\n    #[Test]\n    public function it_is_disabled_if_environment_is_not_local(): void\n    {\n        $this->notLocal()->boot();\n\n        $this->assertDbProfilerNotActivated();\n    }\n\n    #[Test]\n    public function it_is_disabled_if_environment_is_local_but_there_is_no_vvv_option(): void\n    {\n        $this->local()->boot();\n\n        $this->assertDbProfilerNotActivated();\n    }\n\n    #[Test]\n    public function it_is_enabled_if_environment_is_local_and_there_is_vvv_option(): void\n    {\n        $this->local()->withVvv()->boot();\n\n        $this->assertDbProfilerActivated();\n        $this->assertDbQueriesDumped();\n    }\n\n    #[Test]\n    public function it_is_enabled_if_environment_is_not_local_but_there_is_a_force_flag_in_config(): void\n    {\n        config(['db-profiler.force' => true]);\n\n        $this->notLocal()->withVvv()->boot();\n\n        $this->assertDbProfilerActivated();\n        $this->assertDbQueriesDumped();\n    }\n}\n"
  },
  {
    "path": "tests/HttpProfilingTest.php",
    "content": "<?php\n\nnamespace Illuminated\\Database\\Tests;\n\nuse Illuminate\\Support\\Facades\\Request;\nuse PHPUnit\\Framework\\Attributes\\Test;\n\nclass HttpProfilingTest extends TestCase\n{\n    /**\n     * Define whether the app is running in console or not.\n     */\n    protected function runningInConsole(): bool\n    {\n        return false;\n    }\n\n    /**\n     * Emulate the \"vvv\" flag set.\n     */\n    protected function withVvv(): self\n    {\n        Request::merge(['vvv' => true]);\n\n        return $this;\n    }\n\n    #[Test]\n    public function it_is_disabled_if_environment_is_not_local(): void\n    {\n        $this->notLocal()->boot();\n\n        $this->assertDbProfilerNotActivated();\n    }\n\n    #[Test]\n    public function it_is_disabled_if_environment_is_local_but_there_is_no_vvv_request_param(): void\n    {\n        $this->local()->boot();\n\n        $this->assertDbProfilerNotActivated();\n    }\n\n    #[Test]\n    public function it_is_enabled_if_environment_is_local_and_there_is_vvv_request_param(): void\n    {\n        $this->local()->withVvv()->boot();\n\n        $this->assertDbProfilerActivated();\n        $this->assertDbQueriesDumped();\n    }\n}\n"
  },
  {
    "path": "tests/TestCase.php",
    "content": "<?php\n\nnamespace Illuminated\\Database\\Tests;\n\nuse Illuminate\\Database\\Events\\QueryExecuted;\nuse Illuminate\\Foundation\\Application;\nuse Illuminate\\Support\\Facades\\DB;\nuse Illuminated\\Database\\DbProfilerServiceProvider;\nuse Illuminated\\Database\\Tests\\App\\Post;\nuse Illuminated\\Testing\\TestingTools;\nuse Mockery;\n\nMockery::globalHelpers();\n\nabstract class TestCase extends \\Orchestra\\Testbench\\TestCase\n{\n    use TestingTools;\n\n    /**\n     * The emulated environment.\n     */\n    private string $env;\n\n    /**\n     * Setup the test environment.\n     */\n    protected function setUp(): void\n    {\n        parent::setUp();\n\n        $this->setUpDatabase();\n    }\n\n    /**\n     * Setup the database.\n     */\n    private function setUpDatabase(): void\n    {\n        config(['database.default' => 'testing']);\n        config(['database.connections.testing.foreign_key_constraints' => true]);\n\n        $this->artisan('migrate', [\n            '--database' => 'testing',\n            '--path' => relative_path(__DIR__, base_path()) . '/fixture/database/migrations/',\n        ])->assertSuccessful();\n    }\n\n    /**\n     * Emulate the local environment.\n     */\n    protected function local(): self\n    {\n        $this->env = 'local';\n\n        return $this;\n    }\n\n    /**\n     * Emulate the non-local environment.\n     */\n    protected function notLocal(): self\n    {\n        $this->env = 'production';\n\n        return $this;\n    }\n\n    /**\n     * Define whether the app is running in console or not.\n     */\n    abstract protected function runningInConsole(): bool;\n\n    /**\n     * Emulate the \"vvv\" flag set.\n     */\n    abstract protected function withVvv(): self;\n\n    /**\n     * Emulate the app boot.\n     */\n    protected function boot(): void\n    {\n        $app = mock(Application::class);\n        $app->expects('isLocal')->andReturn($this->env == 'local');\n        $app->allows('runningInConsole')->andReturn($this->runningInConsole());\n        $app->allows('configurationIsCached')->andReturnTrue();\n\n        $serviceProvider = new DbProfilerServiceProvider($app);\n        $serviceProvider->register();\n        $serviceProvider->boot();\n    }\n\n    /**\n     * Assert that the database profiler is activated.\n     */\n    protected function assertDbProfilerActivated(): void\n    {\n        $connection = DB::connection();\n        $dispatcher = $connection->getEventDispatcher();\n        $this->assertTrue($dispatcher->hasListeners(QueryExecuted::class));\n    }\n\n    /**\n     * Assert that the database profiler is not activated.\n     */\n    protected function assertDbProfilerNotActivated(): void\n    {\n        $connection = DB::connection();\n        $dispatcher = $connection->getEventDispatcher();\n        $this->assertFalse($dispatcher->hasListeners(QueryExecuted::class));\n    }\n\n    /**\n     * Assert that the database queries are dumped.\n     */\n    protected function assertDbQueriesDumped(): void\n    {\n        $queries = collect([\n            '[1]: select * from \"posts\"',\n            '[2]: select * from \"posts\" where \"posts\".\"id\" = 1 limit 1',\n            '[3]: select * from \"posts\" where \"posts\".\"id\" = \\'2\\' limit 1',\n            '[4]: select * from \"posts\" where \"title\" = \\'foo bar baz\\'',\n            '[5]: select * from \"posts\" where \"price\" > 123.45',\n            '[6]: select * from \"posts\" where \"price\" < \\'543.21\\'',\n            '[7]: select * from \"posts\" where \"is_enabled\" = 1',\n            '[8]: select * from \"posts\" where \"is_enabled\" = 0',\n            '[9]: select * from \"posts\" where \"is_enabled\" = 1',\n            '[10]: select * from \"posts\" where \"is_enabled\" = \\'1\\'',\n            '[11]: select * from \"posts\" where \"id\" in (1, \\'2\\', 3)',\n            '[12]: select * from \"posts\" where \"title\" in (\\'foo\\', \\'bar\\', \\'baz\\')',\n            '[13]: select * from \"posts\" where \"price\" in (1.23, \\'2.34\\', 3.45)',\n            '[14]: select * from \"posts\" where \"is_enabled\" in (1, 0, 1, 0, \\'1\\', \\'0\\')',\n            '[15]: select * from \"posts\" where \"id\" > 3 and \"title\" = \\'foo bar baz\\' and \"price\" > 123.45 and \"is_enabled\" = 1 and \"created_at\" > \\'2016-11-03 21:00:00\\' limit 1',\n            '[16]: select * from \"posts\" where \"title\" is null',\n            '[17]: select * from \"posts\" where \"title\" is null and \"price\" > 123.45',\n        ]);\n\n        $mock = Mockery::mock();\n        app()->instance('db.idpdumper', $mock);\n\n        $queries->each(function (string $query) use ($mock) {\n            $queryPattern = $this->prepareQueryPattern($query);\n            $mock->shouldReceive('dump')->with(Mockery::pattern($queryPattern))->once();\n        });\n\n        Post::all();\n        Post::query()->find(1);\n        Post::query()->find('2');\n        Post::query()->where('title', 'foo bar baz')->get();\n        Post::query()->where('price', '>', 123.45)->get();\n        Post::query()->where('price', '<', '543.21')->get();\n        Post::query()->where('is_enabled', true)->get();\n        Post::query()->where('is_enabled', false)->get();\n        Post::query()->where('is_enabled', 1)->get();\n        Post::query()->where('is_enabled', '1')->get();\n        Post::query()->whereIn('id', [1, '2', 3])->get();\n        Post::query()->whereIn('title', ['foo', 'bar', 'baz'])->get();\n        Post::query()->whereIn('price', [1.23, '2.34', 3.45])->get();\n        Post::query()->whereIn('is_enabled', [true, false, 1, 0, '1', '0'])->get();\n        Post::query()->where('id', '>', 3)->where('title', 'foo bar baz')->where('price', '>', 123.45)->where('is_enabled', true)->where('created_at', '>', '2016-11-03 21:00:00')->first();\n        Post::query()->where('title', null)->get();\n        Post::query()->where('title', null)->where('price', '>', 123.45)->get();\n    }\n\n    /**\n     * Prepare the query pattern for mocking.\n     */\n    private function prepareQueryPattern(string $query): string\n    {\n        $query = preg_quote($query, '/');\n\n        return \"/{$query}; \\(.*? ms\\)/\";\n    }\n\n    /**\n     * Clean up the testing environment before the next test.\n     */\n    protected function tearDown(): void\n    {\n        $connection = DB::connection();\n        $dispatcher = $connection->getEventDispatcher();\n\n        if ($dispatcher->hasListeners(QueryExecuted::class)) {\n            $dispatcher->forget(QueryExecuted::class);\n        }\n\n        parent::tearDown();\n    }\n}\n"
  },
  {
    "path": "tests/fixture/app/Post.php",
    "content": "<?php\n\nnamespace Illuminated\\Database\\Tests\\App;\n\nuse Illuminate\\Database\\Eloquent\\Model;\n\nclass Post extends Model\n{\n    /**\n     * The attributes that are mass assignable.\n     */\n    protected $fillable = ['title'];\n}\n"
  },
  {
    "path": "tests/fixture/database/migrations/2016_11_01_131415_create_posts_table.php",
    "content": "<?php\n\nuse Illuminate\\Database\\Migrations\\Migration;\nuse Illuminate\\Database\\Schema\\Blueprint;\nuse Illuminate\\Support\\Facades\\Schema;\n\nreturn new class extends Migration\n{\n    /**\n     * Run the migration.\n     */\n    public function up(): void\n    {\n        Schema::create('posts', function (Blueprint $table) {\n            $table->increments('id');\n            $table->string('title');\n            $table->float('price');\n            $table->boolean('is_enabled');\n            $table->timestamps();\n        });\n    }\n\n    /**\n     * Rollback the migration.\n     */\n    public function down(): void\n    {\n        Schema::drop('posts');\n    }\n};\n"
  }
]