定制 aiiro/laravel-factory-generator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

aiiro/laravel-factory-generator

最新稳定版本:v0.0.4

Composer 安装命令:

composer require aiiro/laravel-factory-generator

包简介

README 文档

README

Make Laravel factory file with the column names of a table in a database.

screenshot

Installing

composer require --dev aiiro/laravel-factory-generator

If you are using Laravel 5.5 or higher, the package will be automatically registered.

Configuration

Optionally, you can publish the config file by running this command.

php artisan vendor:publish --provider="Aiiro\Factory\FactoryGeneratorServiceProvider"

And then, you can find config\factory-generator.php.

<?php

return [
    
    /**
     * Set the namespace of the model.
     */
    'namespace' => [
        'model' => 'App',
    ],

    /**
     * List of the columns that will not appear in the factory.
     */
    'ignored_columns' => [
        'id',
    ],
];

Usage

After installing and Configuration, you can generate the factory file by running the following command.

Please pass the table name to generate:factory command as the argument.

php artisan generate:factory some_samples

NOTE This command connects to the database to retrieve the columns from table, so make sure that the database is configured.

To generate factories of all tables in database.

Use --all option without table name, to generate factories of all tables in database.

If a factory of table exists, it will be skipped and continue to generate factories of other tables.

php artisan generate:factory  --all

If you cannot use configuration after publishing

clear cache with below command. php artisan config:clear

License

This project is released under MIT License. See MIT License for the detail.

统计信息

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

GitHub 信息

  • Stars: 9
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-03-10