%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/news/database/seeds/
Upload File :
Create Path :
Current File : /var/www/html/news/database/seeds/DatabaseSeeder.php

<?php

use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        \DB::statement('SET FOREIGN_KEY_CHECKS=0');
        $this->truncate();
        \DB::statement('SET FOREIGN_KEY_CHECKS=1');
        try {
            $this->call(RolesTableSeeder::class);
            $this->call(AdminSeeder::class);
            $this->call(UsersTableSeeder::class); //TODO: remove on release
            $this->call(ConfigurationSeeder::class);
            $this->call(NotificationsSeeder::class);
            $this->call(CategorySeeder::class); //TODO: remove on release
            $this->call(TagSeeder::class); //TODO: remove on release
            $this->call(ArticleSeeder::class); //TODO: remove on release
            $this->call(CommentsTableSeeder::class); //TODO: remove on release
            $this->call(SocialsTableSeeder::class);
            $this->call(SubscriptionSeeder::class);//TODO: remove on release
        } catch (\Watson\Validating\ValidationException $exception) {
            $this->command->error($exception->getMessageBag());
        }
    }

    private function truncate()
    {
        $tables = \DB::select("SELECT table_name FROM information_schema.tables where table_schema='" . env('DB_DATABASE') . "' and table_name <> 'migrations'");
        foreach ($tables as $table) {
            \DB::table($table->table_name)->truncate();
        }
    }
}

Zerion Mini Shell 1.0