Run the database seeds.

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

        foreach ($this->languages as $language) {
            Language::create(
                $this->languages()[$language]
            );
        }
    }
1334707
public function run()
    {
        session_start();
        self::$_app = $this;
        if (empty($this->_runtimePath)) {
            $this->_runtimePath = $this->_basePath . '/runtime';
        }
        $application = $this->getComponent('application');
        $application->runController();
    }
968279
public function run()
    {
        factory(\App\Entities\Admin\Categoria::class, 6)->create();

        factory(\App\Entities\Admin\Tag::class, 10)->create();

        factory(\App\Entities\Admin\Noticia::class, 20)->create()->each(function ($n){{
            $tags = \App\Entities\Admin\Tag::all()->random()->id;
            $n->tags()->sync($tags);
        }});
    }
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');
                        }
                    }
                }
            }
        }
    }
1136977
public function run()
    {
        $topdir = $this->getBasePath();

        foreach (scandir($topdir) as $filename) {

            // Skip directory link files
            if (($filename == '.') || ($filename == '..')) {
                continue;
            }

            if (is_dir($topdir . DIRECTORY_SEPARATOR . $filename)) {
                // Recurse into lower level directory, providing the namespace
                $this->loadFiles($filename, $filename);
            }
        }
    }
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,
            ));
        }
    }
1227440
public function run()
    {
        $old = explode(' ', $this->parameters['previous']);
        $new = explode(' ', $this->parameters['current']);
        $out = $this->parameters['output'];
        
        $diff = new taoDevTools_models_RdfDiff();
        foreach ($old as $file) {
            $diff->removeRdf($file);
        }
        foreach ($new as $file) {
            $diff->addRdf($file);
        }
        file_put_contents($out, $diff->exportDiffToSql());
    }
1200575
public function run()
	{
		$this->permissionsUserSeeder();
        $this->permissionsRoleSeeder();
        $this->permissionsSeeder();
        $this->permissionsAllSeeder();
        $this->rolesSeeder();
        $this->addPermissionRoleSeeder();
		$this->usersSeeder();
		$this->roleUserSeeder();
	}
768166
public function run()
    {
        $this->seed([
            [
                'group'       => [
                    'name'        => 'Blog',
                    'slug'        => 'blog',
                    'description' => 'Blog permissions group',
                ],
                'permissions' => array_merge(
                    $this->getDashboardPermissions(),
                    $this->getPostsPermissions(),
                    $this->getCategoriesPermissions(),
                    $this->getTagsPermissions()
                ),
            ],
        ]);
    }
1326565
public function run()
    {
        Model::unguard();

        DB::statement('SET FOREIGN_KEY_CHECKS=0;');

        $this->call('Modules\Blog\Database\Seeders\CategoriesTableSeeder');
        $this->call('Modules\Blog\Database\Seeders\PostsTableSeeder');
        $this->call('Modules\Blog\Database\Seeders\CommentsTableSeeder');
        $this->call('Modules\Blog\Database\Seeders\CategoriesContentTableSeeder');
        $this->call('Modules\Blog\Database\Seeders\PostsContentTableSeeder');

        DB::statement('SET FOREIGN_KEY_CHECKS=1;');
    }
451321
public function run()
    {
        $groups = $this->groups ?: $this->groups();
        DB::table('group_permissions')->truncate();

        foreach ($groups as $group) {
            $permissions = $group['permissions'] ?? [];
            unset($group['permissions']);

            /** @var Group $groupModel */
            $groupModel = Group::firstOrCreate($group);

            foreach ($permissions as $permission) {
                $groupModel->grantPermissions(Permission::firstOrCreate($permission));
            }
        }
    }
391885
public function run()
    {
        $this->seed([
            [
                'group'       => [
                    'name'        => 'SEO',
                    'slug'        => 'seo',
                    'description' => 'SEO permissions group',
                ],
                'permissions' => array_merge(
                    $this->getDashboardSeeds(),
                    $this->getPagesSeeds(),
                    $this->getFootersSeeds(),
                    $this->getMetasSeeds(),
                    $this->getRedirectsSeeds()
                ),
            ],
        ]);
    }
109713
public function run()
    {

         //Get The Models To put In Database
        $models = collect([
                    'Post' => Post::class,
                    'Tag' => Tag::class,
                    'Category' => Category::class
                     ]);

        //Each Model Got His Attribues
        $columns = collect([
               'Post' => [
                    'title' => [
                        'required|max:150',
                        'text',
                        true,
                        null
                    ],
                    'slug' => [
                        'required|unique:posts,slug',
                        'text',
                        true,
                        null
                    ],
                    'content' => [
                        'required',
                        'rich_text_box',
                        false,
                        null
                    ],
                    'description' => [
                        'required|max:250',
                        'text_area',
                        false,
                        null
                    ],
                    'featured' => [
                        null,
                        'checkbox',
                        false,
                        null
                    ],
                    'tags' => [
                        null,
                        'tags',
                        false,
                        null
                    ],
                    'category' => [
                        'required',
                        'category',
                        false,
                        null
                    ],
                    'image' => [
                        'required|mimes:jpeg,bmp,png',
                        'image',
                        true,
                        null
                    ],
                    'status' => [
                        null,
                        'status',
                        true,
                        [
                            [
                                'value' => 'PUBLISHED',
                                'option' => 'PUBLISHED'
                            ],
                            [
                                'value' => 'PENDING',
                                'option' => 'PENDING'
                            ],
                            [
                                'value' => 'DRAFT',
                                'option' => 'DRAFT'
                            ]
                        ],
                    ]
                ],
               'Tag' => [
                    'name' => [
                        'required|max:156',
                        'text',
                        true,
                        null
                    ],
                    'slug' => [
                        'required|max:100|unique:tags,slug',
                        'string',
                        true,
                        null
                    ]
                ],
               'Category' => [
                    'name' => [
                        'required|max:156',
                        'text',
                        true,
                        null
                    ],
                    'slug' => [
                        'required|max:100|unique:categories,slug',
                        'string',
                        true,
                        null
                    ]
                ]
               ]);
      $settings = collect([
        'title' => [
            'Site Title',
            'text'
        ],
        'description' => [
            'Site Description',
            'text'
        ],
        'logo' => [
            'Site Logo',
            'image'
        ],
        'google_analytics_client_id' => [
            'Google Api Id',
            'text'
        ]
      ]);


        $this->command->info('Laramin Data Seeder');

        $this->command->info('Seed Settings');
        $settings->each(function($value,$index) {
            $this->command->info('Creating Settings for '.$index);
            Settings::create([
                    'key' => $index,
                    'display_name' => $value[0],
                    'type' => $value[1],
            ]);
        });


        $models->each(function ($model, $index) use ($columns) {
            $this->command->info('Creating Data Type to '.$index);

            $res = DataType::create([
                        'name' => $index,
                        'menu' => true,
                        'model' =>  $index,
                        'slug' => strtolower($index),
                    ]);
            $id = $res->id;
            $columns->filter(function ($item, $key) use ($index, $id) {
                return $key == $index;
            })->Flatmap(function ($item, $key) use ($id) {
                return $item;
            })->each(function ($item, $key) use ($id) {
                $this->command->info('Creating Data Info '.$key.' for '.DataType::find($id)->name);

                DataInfo::create([
                        'data_types_id' => $id,
                        'column' => $key,
                        'type' => $item[1],
                        'validation' => $item[0] == null ? NULL : json_encode($item[0]),
                        'details' => $item[3] == null ? NULL : json_encode($item[3]),
                        'display' => $item[2]
                    ]);
            });
        });
    }
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,
            ]);
        }
    }
1191729
public function run()
    {
        User::whereUsername('admin')->first()->assignRole(Role::whereName('admin')->first());
        User::whereUsername('user')->first()->assignRole(Role::whereName('user')->first());
    }
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()
                ),
            ],
        ]);
    }
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);

        }
    }