You can install the package via composer:
composer require io-digital/truncate-tables
In database/seeders/DatabaseSeeder.php
:
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use IoDigital\TruncateTable\TruncateTable;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
{
TruncateTable::fromArrays([
'users',
'posts'
])->clean();
// Or like the following
TruncateTable::fromArrays([
'users',
'posts'
], [
UserTableSeeder::class,
PostTableSeeder::class,
])->cleanAndSeed();
}
}
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.