src/Seeder/Seeder.php
public function truncateTables()
    {
        $dbName = env('DB_DATABASE');

        // Get all tables list, except migrations table
        $tables = DB::select('SHOW TABLES WHERE `Tables_in_'.$dbName.'` != ?', ['migrations']);

        DB::statement('SET FOREIGN_KEY_CHECKS=0;');
        foreach ($tables as $table) {
            DB::table($table->{'Tables_in_' . $dbName})->truncate();
        }
        DB::statement('SET FOREIGN_KEY_CHECKS=1;');
    }
public function truncateTables()
    {
        $dbName = env('DB_DATABASE');

        // Get all tables list, except migrations table
        $tables = DB::select('SHOW TABLES WHERE `Tables_in_'.$dbName.'` != ?', ['migrations']);

        DB::statement('SET FOREIGN_KEY_CHECKS=0;');
        foreach ($tables as $table) {
            DB::table($table->{'Tables_in_' . $dbName})->truncate();
        }
        DB::statement('SET FOREIGN_KEY_CHECKS=1;');
    }
public function truncateTables ( ) { $ dbName = env ( 'DB_DATABASE' ) ; // Get all tables list, except migrations table $ tables = DB :: select ( 'SHOW TABLES WHERE `Tables_in_' . $ dbName . '` != ?' , [ 'migrations' ] ) ; DB :: statement ( 'SET FOREIGN_KEY_CHECKS=0;' ) ; foreach ( $ tables as $ table ) { DB :: table ( $ table -> { 'Tables_in_' . $ dbName } ) -> truncate ( ) ; } DB :: statement ( 'SET FOREIGN_KEY_CHECKS=1;' ) ; }
Truncates all tables except migrations.
Truncates all tables except migrations .