ylsalame/laravelseedgenerator

Laravel Seed Generator

0.5 2018-12-05 17:15 UTC

This package is not auto-updated.

Last update: 2024-09-20 22:33:13 UTC


README

Artisan 命令用于 Laravel,通过简单的可视化界面创建 Seeder 文件,用于当前数据库中的数据

安装

  1. ylsalame/seedgenerator 添加到 composer.json
composer require ylsalame/laravelseedgenerator

或者

"require": {
	"ylsalame/laravelseedgenerator": "^0.5"
}
  1. 通过 CLI 更新 Composer
composer update

使用方法(Artisan)

php artisan seedgenerator

Seed Generator 是一个具有可视化界面的脚本工具。这意味着在你通过可视化确认并认可将要执行的操作之前,不会有任何操作被执行。以下是一个界面的示例

命令选项/标志

连接

[optional] The name of the connection to be used. 
[default] fetched from Config::database.default
If no connection is passed and no conneciton is configured in the Laravel config the script will raise an exception.

跳过的表

[optional] A list of tables for the script to skip delimited by commas
[default] {empty}

不覆盖

[optional] Boolean flag that will make the script avoid overwritting exiting files
[default] false

限制记录数

[optional] The amount of records to limit when generating the seeder file for a table. If ommited, all records will be fetched and added to the seeder file
[default] {empty}

输出

表 Seeder 文件

在模式中检测到的每个表都将生成自己的 Seeder 文件。这个 Seeder 文件将包含表在当前时间所包含的全部数据。

Path: \database\seeds
Naming convention: {table_name}Seeder.php

数据库 Seeder 文件

数据库 Seeder 文件将包含所有表 Seeder 文件的触发器。跳过的表将不包括在这个文件中。

Path: \database\seeds
Naming convention: It will be saved with the name DatabaseSeeder.php to maintain the Laravel standard.