PHP code example of io-digital / truncate-tables

1. Go to this page and download the library: Download io-digital/truncate-tables library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

io-digital / truncate-tables example snippets




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();
    }
}