Run the database seeds.

@return void
764850
public function run()
    {
        foreach($this->dumpFiles() as $dumpPart) {

            $query = "LOAD DATA LOCAL INFILE '"
                    . str_replace('\\', '/', $dumpPart) . "'
                    INTO TABLE `" . Config::citiesTableName() . "` 
                        FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"'
                        LINES TERMINATED BY '\n' IGNORE 1 LINES
                        (country,
                        city_ascii,
                        city,
                        region,
                        population,
                        latitude,
                        longitude
                    )";

            DB::connection()->getpdo()->exec($query);

        }
    }
618077
public function run()
    {
        DB::statement('SET FOREIGN_KEY_CHECKS=0;');

        DB::table('role_has_permissions')->truncate();
        DB::table('user_has_roles')->truncate();
        DB::table('user_has_permissions')->truncate();
        DB::table('roles')->truncate();
        DB::table('permissions')->truncate();
        DB::table('users')->truncate();
        $this->call(RolesTableSeeder::class);
        $this->call(PermissionsTableSeeder::class);
        $this->call(UsersTableSeeder::class);
        $this->call(PermissionRoleTableSeeder::class);
        $this->call(RoleUserTableSeeder::class);

        DB::statement('SET FOREIGN_KEY_CHECKS=0;');
    }
241634
public function run()
    {
        $datas = [
            ['publicable' => true,'key' => 'site_name', 'value' => 'Live CMS'],
            ['publicable' => true,'key' => 'site_initial', 'value' => 'LC'],
            ['publicable' => true,'key' => 'site_email', 'value' => 'no.reply@livecms.dev'],
            ['publicable' => true,'key' => 'slug_admin', 'value' => '@'],
            ['publicable' => true,'key' => 'slug_article', 'value' => 'a'],
            ['publicable' => true,'key' => 'slug_staticpage', 'value' => 'p'],
            ['publicable' => true,'key' => 'slug_search', 'value' => 'search'],
            ['publicable' => true,'key' => 'mailchimp_key', 'value' => ''],
            ['publicable' => true,'key' => 'mailchimp_form_url', 'value' => ''],
            ['publicable' => true,'key' => 'google_analytic_id', 'value' => ''],
        ];

        foreach ($datas as $data) {
            $exist = DB::table('settings')->where(array_only($data, ['publicable', 'key']))->first();
            if (!$exist) {
                DB::table('settings')->insert($data);
            }
            
        }
    }
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);
    }
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);
            }
        }
    }
908387
public function run()
    {
        /**
         * Get Available Permissions.
         */
        $permissions = config('roles.models.permission')::all();

        /**
         * Attach Permissions to Roles.
         */
        $roleAdmin = config('roles.models.role')::where('name', '=', 'Admin')->first();
        foreach ($permissions as $permission) {
            $roleAdmin->attachPermission($permission);
        }
    }
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');
                        }
                    }
                }
            }
        }
    }
457663
public function run()
    {
        $this->call(SetupSeeder::class);
        $this->call(DefaultRoleSeeder::class);
        $this->call(DefaultSuperAdminUserSeeder::class);
        $this->call(DefaultAdminUserSeeder::class);
    }
310125
public function run()
    {
        \DB::table('lfm_categories')->delete();
        \DB::table('lfm_categories')->insert(
            array (
                'id' => '0',
                'user_id' => 0,
                'title' => 'Root folder',
                'title_disc' => 'root_folder',
                'description' => 'root',
                'parent_category_id' => '#',
                'created_by' => 0,
                'created_at' => NULL,
                'updated_at' => NULL,
                'deleted_at' => NULL,
            )
        );
        \DB::unprepared("UPDATE lfm_categories SET id=0");
        \DB::table('lfm_categories')->insert(array (
            0 =>
                array (
                    'id' => -5,
                    'user_id' => 0,
                    'title' => 'Direct upload',
                    'title_disc' => 'direct_folder',
                    'description' => 'direct upload folder',
                    'parent_category_id' => '#',
                    'created_by' => 0,
                    'created_at' => NULL,
                    'updated_at' => NULL,
                    'deleted_at' => NULL,
                ),
            1 =>
                array (
                    'id' => -2,
                    'user_id' => 0,
                    'title' => 'Share folder',
                    'title_disc' => 'share_folder',
                    'description' => 'share',
                    'parent_category_id' => '#',
                    'created_by' => 0,
                    'created_at' => NULL,
                    'updated_at' => NULL,
                    'deleted_at' => NULL,
                ),
            2 =>
                array (
                    'id' => -1,
                    'user_id' => 0,
                    'title' => 'public folder',
                    'title_disc' => 'public_folder',
                    'description' => 'public',
                    'parent_category_id' => '#',
                    'created_by' => 0,
                    'created_at' => NULL,
                    'updated_at' => NULL,
                    'deleted_at' => NULL,
                ),
        ));

    }
557148
public function run()
    {
        $this->languages = ['ru', 'en'];

        foreach ($this->languages as $language) {
            Language::create(
                $this->languages()[$language]
            );
        }
    }
141995
public function run()
    {
        $data = $this->getData();

        // If blade is enabled, initialize it
        if ($this->isBladeEnabled())
        {
            $bladeConfig = $data['blade'];

            // Setup blade and paths
            $viewsPath = $bladeConfig['paths']['views'];
            $cachePath = $bladeConfig['paths']['cache'];
            $blade = new Blade($viewsPath, $cachePath);

            // Extend blade
            /** @var \Illuminate\View\Compilers\BladeCompiler $compiler */
            $compiler = $blade->getCompiler();
            $extensions = array(
                new WordPressLoopExtension(),
                new WordPressQueryExtension(),
                new WordPressShortcodeExtension()
            );

            /** @var Extension $ext */
            foreach ($extensions as $ext)
            {
                $ext->register($compiler);
            }

            // Set the blade engine in the facade
            Baobab::setBlade($blade);
        }
    }
406188
public function run()
    {
        $this->call(ImageStylesTableSeeder::class);
        $this->call(PermissionsTableSeeder::class);
        $this->call(RolesTableSeeder::class);
        $this->call(UsersTableSeeder::class);
    }
730735
public function run(): void
    {
        foreach (self::SETTINGS as $setting_name => $setting_value) {
            DB::table('site_setting')->updateOrInsert([
                'setting_name'  => $setting_name,
            ], [
                'setting_value' => $setting_value,
            ]);
        }
    }
1107434
public function run()
    {
        Eloquent::unguard();

        $this->call('GrahamCampbell\CMSCore\Seeds\GroupsTableSeeder');
        $this->call('GrahamCampbell\CMSCore\Seeds\UsersTableSeeder');
        $this->call('GrahamCampbell\CMSCore\Seeds\UsersGroupsTableSeeder');

        $this->call('GrahamCampbell\CMSCore\Seeds\PagesTableSeeder');
        $this->call('GrahamCampbell\CMSCore\Seeds\PostsTableSeeder');
        $this->call('GrahamCampbell\CMSCore\Seeds\CommentsTableSeeder');
        $this->call('GrahamCampbell\CMSCore\Seeds\EventsTableSeeder');
    }
1243947
public function run()
    {
        $vendorDir = dirname(dirname(__FILE__));
        $baseDir = dirname($vendorDir);
        spl_autoload_register(function ($className) use($baseDir) {
            if (file_exists($file = $baseDir . '/database/seeds/' . $className . '.php')) {
                include($file);
                return true;
            }
        });

        $this->call([
            ModulesTableSeeder::class,
            PrivilegesTableSeeder::class,
            SettingsTableSeeder::class,
        ]);
    }
619180
public function run()
    {
        DB::beginTransaction();
        try {
            $this->down();
            $this->addNotification([
                'category' => 'default',
                'severity' => 'high',
                'type'     => 'email',
                'event'    => 'email.sample-module-notification',
                'contents' => [
                    'en' => [
                        'title'   => 'Sample Email Template',
                        'content' => file_get_contents(__DIR__ . '/../../views/notification/module_sample_notification.twig')
                    ],
                ]
            ]);
        } catch (Exception $ex) {
            DB::rollback();
            throw $ex;
        }

        DB::commit();
    }
789296
public function run()
    {
        DB::table('users_groups')->delete();

        $this->matchUser('admin@dsmg.co.uk', 'Admins');
        $this->matchUser('semiadmin@dsmg.co.uk', 'Moderators');
        $this->matchUser('semiadmin@dsmg.co.uk', 'Bloggers');
        $this->matchUser('semiadmin@dsmg.co.uk', 'Editors');
        $this->matchUser('moderator@dsmg.co.uk', 'Moderators');
        $this->matchUser('blogger@dsmg.co.uk', 'Bloggers');
        $this->matchUser('editor@dsmg.co.uk', 'Editors');
        $this->matchUser('user@dsmg.co.uk', 'Users');
    }