PHP 8.3.31
Preview: LazilyRefreshDatabase.php Size: 1.15 KB
/home/getspomw/royalsquad.us/vendor/laravel/framework/src/Illuminate/Foundation/Testing/LazilyRefreshDatabase.php

<?php

namespace Illuminate\Foundation\Testing;

trait LazilyRefreshDatabase
{
    use RefreshDatabase {
        refreshDatabase as baseRefreshDatabase;
    }

    /**
     * Define hooks to migrate the database before and after each test.
     *
     * @return void
     */
    public function refreshDatabase()
    {
        $database = $this->app->make('db');

        $callback = function () {
            if (RefreshDatabaseState::$lazilyRefreshed) {
                return;
            }

            RefreshDatabaseState::$lazilyRefreshed = true;

            if (property_exists($this, 'mockConsoleOutput')) {
                $shouldMockOutput = $this->mockConsoleOutput;

                $this->mockConsoleOutput = false;
            }

            $this->baseRefreshDatabase();

            if (property_exists($this, 'mockConsoleOutput')) {
                $this->mockConsoleOutput = $shouldMockOutput;
            }
        };

        $database->beforeStartingTransaction($callback);
        $database->beforeExecuting($callback);

        $this->beforeApplicationDestroyed(function () {
            RefreshDatabaseState::$lazilyRefreshed = false;
        });
    }
}

Directory Contents

Dirs: 2 × Files: 12

Name Size Perms Modified Actions
Concerns DIR
- drwxrwxrwx 2025-09-17 06:52:55
Edit Download
Traits DIR
- drwxrwxrwx 2025-09-17 06:52:55
Edit Download
1.36 KB lrw-rw-rw- 2025-09-17 06:52:55
Edit Download
1.61 KB lrw-rw-rw- 2025-09-17 06:52:55
Edit Download
1.83 KB lrw-rw-rw- 2025-09-17 06:52:55
Edit Download
6.44 KB lrw-rw-rw- 2025-09-17 06:52:55
Edit Download
1.15 KB lrw-rw-rw- 2025-09-17 06:52:55
Edit Download
4.03 KB lrw-rw-rw- 2025-09-17 06:52:55
Edit Download
516 B lrw-rw-rw- 2025-09-17 06:52:55
Edit Download
1.80 KB lrw-rw-rw- 2025-09-17 06:52:55
Edit Download
344 B lrw-rw-rw- 2025-09-17 06:52:55
Edit Download
1.21 KB lrw-rw-rw- 2025-09-17 06:52:55
Edit Download
500 B lrw-rw-rw- 2025-09-17 06:52:55
Edit Download
5.73 KB lrw-rw-rw- 2025-09-17 06:52:55
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).