Run the database seeds.

@return void
191210
public function run()
    {
        $MenuTypes = ['header', 'sidebar', 'footer'];

        foreach ($MenuTypes as $MenuType) {
            $Type = ['type' => $MenuType];

            factory(Menu::class, 5)->create($Type)->each(function ($u) use ($Type) {
                $u->children()->saveMany(factory(Menu::class, 2)->create($Type)
                    ->each(function ($p) use ($Type) {
                        $p->children()->saveMany(factory(Menu::class, 2)->make($Type));
                    }));
            });
        }
    }
274956
public function run()
	{
		$this->call(UsersTableSeeder::class);
		$this->call(ConfTableSeeder::class);
		$this->call(LangTableSeeder::class);
		
		$this->call(MediaCategoryTableSeeder::class);
		$this->call(MediaTypeTableSeeder::class);
		
		$this->call(PageTableSeeder::class);
		$this->call(PageLangTableSeeder::class);
		$this->call(NavigationGroupTableSeeder::class);
	}
200356
protected function runSeeds()
	{
		foreach($this->getSeeders() as $file) {
			require_once $file;
			$className = basename($file, '.php');
			$this->runSeed($className);
		}
	}
100486
public function run()
    {
        $countries = @json_decode(file_get_contents(realpath(__DIR__ . '/../seeds/countries.json'), true));

        DB::table(config('countries.table_name'))->delete();

        foreach ($countries as $countryId => $country) {
            DB::table(config('countries.table_name'))->insert(array(
                'id' => $countryId,
                'capital' => $country->capital ?? null,
                'citizenship' => $country->citizenship ?? null,
                'country_code' => $country->country_code,
                'currency' => $country->currency ?? null,
                'currency_code' => $country->currency_code ?? null,
                'currency_sub_unit' => $country->currency_sub_unit ?? null,
                'currency_decimals' => $country->currency_decimals ?? null,
                'full_name' => $country->full_name ?? null,
                'iso_3166_2' => $country->iso_3166_2,
                'iso_3166_3' => $country->iso_3166_3,
                'name' => $country->name,
                'region_code' => $country->region_code,
                'sub_region_code' => $country->sub_region_code,
                'eea' => (bool) $country->eea,
                'calling_code' => $country->calling_code,
                'currency_symbol' => $country->currency_symbol ?? null,
                'flag' => $country->flag ?? null,
            ));
        }
    }
699522
public function run()
    {
        $this->seed([
            [
                'group'       => [
                    'name'        => 'Auth',
                    'slug'        => 'auth',
                    'description' => 'Auth permissions group',
                ],
                'permissions' => array_merge(
                    $this->getDashboardPermissions(),
                    $this->getUsersPermissions(),
                    $this->getRolesPermissions(),
                    $this->getPermissionsPermissions(),
                    $this->getPasswordResetsPermissions()
                ),
            ],
        ]);
    }
700092
public function run(): void
    {
        $countries = json_decode(file_get_contents(__DIR__ . '/../../resources/json/countries.json'), true);

        foreach ($countries as $country) {

            $this->connection->beginTransaction();

            try {
                $flag = $this->resourceService->getRepository()->findOneBy(['id' => $country['flag_id']]);

                if (!$flag) {
                    $this->resourceService->download(
                        __DIR__ . '/../../resources/media/flags/' . $country['id'] . '.svg',
                        config('filesystems.default'),
                        'flag-' . $country['id']
                    );
                }

                $translations = $country['translations'];
                array_forget($country, 'translations');

                $countryRecord = $this->countryRepository->updateOrCreate(['id' => $country['id']], $country);
                $countryRecord->updateTranslations($translations);

                $this->connection->commit();

            } catch (\Exception $e) {
                $this->connection->rollBack();
                dd($e);
            }
        }
    }
894814
public function run()
    {
        $this->down();
        DB::transaction(function() {

            DB::table('tbl_widget_types')->insert([
                'id'          => 1,
                'slug'        => 'default',
                'name'        => 'Default Widget',
                'description' => 'Default widget type',
            ]);
            $typeId = DB::getPdo()->lastInsertId();
            DB::table('tbl_widgets')->insert([
                'type_id'    => $typeId,
                'name'       => 'Content',
                'created_at' => Carbon::now(),
            ]);
        });
        $schemasPath     = __DIR__ . DIRECTORY_SEPARATOR . '../schemas';
        $viewsSchemaPath = $schemasPath . DIRECTORY_SEPARATOR . 'default_widgets.sql';
        if (file_exists($viewsSchemaPath)) {
            DB::unprepared(file_get_contents($viewsSchemaPath));
        }
    }
414105
public function run()
    {
        /*
         * Role Types
         *
         */
        $RoleItems = [
            [
                'name'        => 'Admin',
                'slug'        => 'admin',
                'description' => 'Admin Role',
                'level'       => 5,
            ],
            [
                'name'        => 'User',
                'slug'        => 'user',
                'description' => 'User Role',
                'level'       => 1,
            ],
            [
                'name'        => 'Unverified',
                'slug'        => 'unverified',
                'description' => 'Unverified Role',
                'level'       => 0,
            ],
        ];

        /*
         * Add Role Items
         *
         */
        echo "\e[32mSeeding:\e[0m DefaultRoleItemsTableSeeder\r\n";
        foreach ($RoleItems as $RoleItem) {
            $newRoleItem = config('roles.models.role')::where('slug', '=', $RoleItem['slug'])->first();
            if ($newRoleItem === null) {
                $newRoleItem = config('roles.models.role')::create([
                    'name'          => $RoleItem['name'],
                    'slug'          => $RoleItem['slug'],
                    'description'   => $RoleItem['description'],
                    'level'         => $RoleItem['level'],
                ]);
                echo "\e[32mSeeding:\e[0m DefaultRoleItemsTableSeeder - Role:".$RoleItem['slug']."\r\n";
            }
        }
    }
80371
public function run()
    {
        config()->set('gzero-core.db_transactions', false);
        $languages = Language::all()->keyBy('code');
        $users     = $this->seedUsers();
        $contents  = $this->seedContent($languages, $users);
        $this->seedBlock(BlockType::all(), $languages, $users, $contents);
        //$fileTypes    = $this->seedFileTypes();
        //$files        = $this->seedFiles($fileTypes, $languages, $users, $contents, $blocks);
        //$this->seedOptions($languages);
    }
356209
public function run()
    {
        DB::table('posts')->delete();

        $post = array(
            'title'      => 'Hello World',
            'summary'    => 'This is the first blog post.',
            'body'       => 'This is an example blog post.',
            'user_id'    => 1,
            'created_at' => new DateTime,
            'updated_at' => new DateTime
        );

        DB::table('posts')->insert($post);
    }
616704
public function run()
    {
        //
        DB::table('districts')->insert([
            'name' => 'Bawku Municipal',
            'region_id' => 8
        ]);
        DB::table('districts')->insert([
            'name' => 'Bawku West',
            'region_id' => 8
        ]);
        DB::table('districts')->insert([
            'name' => 'Binduri',
            'region_id' => 8
        ]);
        DB::table('districts')->insert([
            'name' => 'Bolgatanga Municipal',
            'region_id' => 8
        ]);
        DB::table('districts')->insert([
            'name' => 'Bongo',
            'region_id' => 8
        ]);
        DB::table('districts')->insert([
            'name' => 'Builsa North',
            'region_id' => 8
        ]);
        DB::table('districts')->insert([
            'name' => 'Builsa South',
            'region_id' => 8
        ]);
        DB::table('districts')->insert([
            'name' => 'Garu-Tempane',
            'region_id' => 8
        ]);
        DB::table('districts')->insert([
            'name' => 'Kassena-Nankana',
            'region_id' => 8
        ]);
        DB::table('districts')->insert([
            'name' => 'Kassena Nankana West',
            'region_id' => 8
        ]);
        DB::table('districts')->insert([
            'name' => 'Nabdam',
            'region_id' => 8
        ]);
        DB::table('districts')->insert([
            'name' => 'Pusiga District',
            'region_id' => 8
        ]);
        DB::table('districts')->insert([
            'name' => 'Talensi',
            'region_id' => 8
        ]);
        DB::table('districts')->insert([
            'name' => 'Bolgatanga East District',
            'region_id' => 8
        ]);
        DB::table('districts')->insert([
            'name' => 'Tempane District',
            'region_id' => 8
        ]);
        
    }
13995
public function run()
    {
        // php artisan db:seed --class="PermissionRoleTableSeeder"
        $permissions = Permission::all();
        $adminRole = Role::whereName('admin')->first();

        foreach ($permissions as $permission) {
            if (! $adminRole->hasPermissionTo($permission)) {
                $adminRole->givePermissionTo($permission->name);
            }
        }
        $rolePermissions = ['manage_pages', 'access_admin'];

        /** @var Role $editorRole */
        $editorRole = Role::whereName('editor')->first();
        foreach ($rolePermissions as $permission) {
            if (! $editorRole->hasPermissionTo($permission)) {
                $editorRole->givePermissionTo($permission);
            }
        }
    }
1186652
public function run()
	{
		$i = 0;
		
		DB::table('conf')->insert([
			'slug' => 'email',
			'value' => 'somebody@somewhere.com',
			'ord' => $i++,
			'created_at' => date("Y-m-d H:i:s"),
			'updated_at' => date("Y-m-d H:i:s")
		]);
		DB::table('conf')->insert([
			'slug' => 'telephone',
			'value' => '070000000',
			'ord' => $i++,
			'created_at' => date("Y-m-d H:i:s"),
			'updated_at' => date("Y-m-d H:i:s")
		]);
		DB::table('conf')->insert([
			'slug' => 'facebook_url',
			'value' => 'http://facebook.com/',
			'ord' => $i++,
			'created_at' => date("Y-m-d H:i:s"),
			'updated_at' => date("Y-m-d H:i:s")
		]);
		DB::table('conf')->insert([
			'slug' => 'youtube_url',
			'value' => 'http://youtube.com/',
			'ord' => $i++,
			'created_at' => date("Y-m-d H:i:s"),
			'updated_at' => date("Y-m-d H:i:s")
		]);
		DB::table('conf')->insert([
			'slug' => 'googleplus_url',
			'value' => 'http://plus.google.com/',
			'ord' => $i++,
			'created_at' => date("Y-m-d H:i:s"),
			'updated_at' => date("Y-m-d H:i:s")
		]);
		DB::table('conf')->insert([
			'slug' => 'pinterest_url',
			'value' => 'http://pinterest.com/',
			'ord' => $i++,
			'created_at' => date("Y-m-d H:i:s"),
			'updated_at' => date("Y-m-d H:i:s")
		]);
		DB::table('conf')->insert([
			'slug' => 'ips',
			'value' => '',
			'ord' => $i++,
			'created_at' => date("Y-m-d H:i:s"),
			'updated_at' => date("Y-m-d H:i:s")
		]);
	}
814386
public function seedDatabase(): void
    {
        (new SeedSiteSettingTable())->run();
        (new SeedUserTable())->run();
        (new SeedGedcomTable())->run();
        (new SeedGedcomSettingTable())->run();
        (new SeedDefaultResnTable())->run();
    }
831605
public function run()
    {
        $this->command->info('Truncating User, Role and Permission tables');
        $this->truncateLaratrustTables();

        $config = config('laratrust_seeder.role_structure');
        $userPermission = config('laratrust_seeder.permission_structure');
        $mapPermission = collect(config('laratrust_seeder.permissions_map'));

        foreach ($config as $key => $modules) {
            // Create a new role
            $role = \Simoja\Laramin\Models\Role::create([
                'name' => $key,
                'display_name' => ucwords(str_replace("_", " ", $key)),
                'description' => ucwords(str_replace("_", " ", $key))
            ]);

            $this->command->info('Creating Role '. strtoupper($key));

            // Reading role permission modules
            foreach ($modules as $module => $value) {
                $permissions = explode(',', $value);

                foreach ($permissions as $p => $perm) {
                    $permissionValue = $mapPermission->get($perm);

                    $permission = \Simoja\Laramin\Models\Permission::firstOrCreate([
                        'name' => $permissionValue . '-' . $module,
                        'display_name' => ucfirst($permissionValue) . ' ' . ucfirst($module),
                        'description' => ucfirst($permissionValue) . ' ' . ucfirst($module),
                    ]);

                    $this->command->info('Creating Permission to '.$permissionValue.' for '. $module);

                    if (!$role->hasPermission($permission->name)) {
                        $role->attachPermission($permission);
                    } else {
                        $this->command->info($key . ': ' . $p . ' ' . $permissionValue . ' already exist');
                    }
                }
            }

            $this->command->info("Creating '{$key}' user");
            // Create default user for each role
            $user = \App\User::create([
                'name' => ucwords(str_replace("_", " ", $key)),
                'email' => $key.'@app.com',
                'password' => bcrypt('password')
            ]);
            $user->attachRole($role);
        }

        // creating user with permissions
        if (!empty($userPermission)) {
            foreach ($userPermission as $key => $modules) {
                foreach ($modules as $module => $value) {
                    $permissions = explode(',', $value);
                    // Create default user for each permission set
                    $user = \App\User::create([
                        'name' => ucwords(str_replace("_", " ", $key)),
                        'email' => $key.'@app.com',
                        'password' => bcrypt('password'),
                        'remember_token' => str_random(10),
                    ]);
                    foreach ($permissions as $p => $perm) {
                        $permissionValue = $mapPermission->get($perm);

                        $permission = \Simoja\Laramin\Models\Permission::firstOrCreate([
                            'name' => $permissionValue . '-' . $module,
                            'display_name' => ucfirst($permissionValue) . ' ' . ucfirst($module),
                            'description' => ucfirst($permissionValue) . ' ' . ucfirst($module),
                        ]);

                        $this->command->info('Creating Permission to '.$permissionValue.' for '. $module);

                        if (!$user->hasPermission($permission->name)) {
                            $user->attachPermission($permission);
                        } else {
                            $this->command->info($key . ': ' . $p . ' ' . $permissionValue . ' already exist');
                        }
                    }
                }
            }
        }
    }
565182
public function run()
    {
        $argument        = Eurekon\Argument::getInstance();
        $directory       = (string) $argument->get('directory');
        $configName      = (string) $argument->get('item');
        $configNamespace = (string) $argument->get('namespace', null, 'global.database');
        $dbName          = (string) $argument->get('db');

        //~ Init db connection
        $container  = Container::getInstance();
        $config  = $container->get('config');
        Database::getInstance()->setConfig($config->get($configNamespace));

        $directory = realpath(trim(rtrim($directory, '\\')));
        $file      = $directory . DIRECTORY_SEPARATOR . 'orm.yml';

        if (!is_readable($file)) {
            throw new \LogicException('Configuration file for ORM not available!');
        }

        $yaml = new Yaml();
        $data = $yaml->load($file);

        $directory = $directory . DIRECTORY_SEPARATOR . $data['orm']['directory'];
        $namespace = $data['orm']['namespace'];

        if (!is_dir($directory) && !mkdir($directory, 0764, true)) {
            throw new \RuntimeException('Cannot created output directory! (dir:' . $directory . ')');
        }

        $configs = $this->findConfigs($file, $data, $configName, true);

        $builder = new Builder();
        $builder->setDatabase(Database::get($dbName));
        $builder->setNamespace($namespace);
        $builder->setDirectory($directory);
        $builder->build($configs);
    }
1140191
public function run()
    {
        $this->command->info('Competitors seeding!');
        $userClass = config('laravel-tournaments.user.model');
        $championship = Championship::where('tournament_id', 1)->first();

        $users[] = factory($userClass)->create(['name' => 't1']);
        $users[] = factory($userClass)->create(['name' => 't2']);
        $users[] = factory($userClass)->create(['name' => 't3']);
        $users[] = factory($userClass)->create(['name' => 't4']);
        $users[] = factory($userClass)->create(['name' => 't5']);

        foreach ($users as $user) {
            factory(Competitor::class)->create([
                'championship_id' => $championship->id,
                'user_id' => $user->id,
                'confirmed' => 1,
            ]);
        }
    }