orangehill/iseed

how to seed all table in one command ?

spham opened this issue · 2 comments

spham commented

Hi
just a question about seed all tables from existables databases

I am also looking for same kind of solution.

hello, to do this I made an artisan command and loop all the tables

public function handle()
{
    foreach (\DB::select('SHOW TABLES') as $value) {
        foreach ($value as $tableName) {
            if (!in_array($tableName, ['migrations', 'password_resets'])) {
                \Artisan::call('iseed', [
                    'tables' => $tableName,
                    '--force' => true,
                ]);
                $this->info('Table ' . $tableName . ' - Done!');
            }
        }
    }
}

regards.