dbt/command-seeder 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dbt/command-seeder

最新稳定版本:1.0.0

Composer 安装命令:

composer create-project dbt/command-seeder

包简介

Command-based seeding for Laravel

README 文档

README

An Artisan console command allows calling seeders with arguments.

Installation

composer require --dev dbt/command-seeder

Config

Publish the config file:

php artisan vendor:publish --provider="Dbt\CommandSeeder\CommandSeederServiceProvider" --tag="config"

Then populate the seeders key with a map like so:

'seeders' => [
    'my-seeder' => MySeeder::class,
];

Seeders

Seeders must extend the CommandSeederAbstract class. Each seeder must provide a list of arguments:

public function argumentNames(): ArgumentNames
{
    return new ArgumentNames('firstArg', 'secondArg', 'etc');
}

These argument names will be matched up (by index) with the provided CLI arguments and will be passed into the run method. If the number of required arguments doesn't match the number of given arguments, an exception will be thrown.

Additionally, the command's OutputStyle is passed into the seeder's constructor so you can output to the console from the seeder:

public function run(Arguments $arguments, int $quantity): void
{
    $firstArg = $arguments->get('firstArg');
    $allArgs = $arguments->all();
    
    // Create some models...
    
    $this->output->info('Write some output...');
}

Usage

php artisan seed:command {seederName} {quantity} {...arguments}

统计信息

  • 总下载量: 260
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固