Seeder example

/** * Returns a new instance of the Database Seeder. * * @phpstan-param null|non-empty-string $group * * @return Seeder */
    public static function seeder(?string $group = null)
    {
        $config = config(DbConfig::class);

        return new Seeder($configstatic::connect($group));
    }

    /** * Ensures the database Connection Manager/Factory is loaded and ready to use. */
    protected static function ensureFactory()
    {
        if (static::$factory instanceof Database) {
            return;
        }

        

    protected $arguments = [
        'seeder_name' => 'The seeder name to run',
    ];

    /** * Passes to Seeder to populate the database. */
    public function run(array $params)
    {
        $seeder   = new Seeder(new Database());
        $seedName = array_shift($params);

        if (empty($seedName)) {
            $seedName = CLI::prompt(lang('Migrations.migSeeder'), null, 'required'); // @codeCoverageIgnore         }

        try {
            $seeder->call($seedName);
        } catch (Throwable $e) {
            $this->showError($e);
        }
    }
Home | Imprint | This part of the site doesn't use cookies.