【问题标题】:How to apply the CRUD generator for Laravel module architecture?如何为 Laravel 模块架构应用 CRUD 生成器?
【发布时间】:2019-08-19 23:53:45
【问题描述】:

我已经使用以下命令在 Laravel 5.8 中创建了一个模块。

php artisan module:make leave

创建了一个休假模块结构。但是如何使用 infyom(或其他)CRUD 生成器在此模块中创建 CRUD 操作?

【问题讨论】:

  • Laravel 不附带 module:make 命令。您可以输入以下内容以查看 Laravel 附带的所有命令:php artisan list

标签: php laravel-5 code-generation crud laravel-5.8


【解决方案1】:

如果你想创建一个model 而不是module,你可以运行

php artisan make:model MyModel -a

    /**
     * Get the console command options.
     *
     * @return array
     */
    protected function getOptions()
    {
        return [
            ['all', 'a', InputOption::VALUE_NONE, 'Generate a migration, factory, and resource controller for the model'],
            ['controller', 'c', InputOption::VALUE_NONE, 'Create a new controller for the model'],
            ['factory', 'f', InputOption::VALUE_NONE, 'Create a new factory for the model'],
            ['force', null, InputOption::VALUE_NONE, 'Create the class even if the model already exists'],
            ['migration', 'm', InputOption::VALUE_NONE, 'Create a new migration file for the model'],
            ['pivot', 'p', InputOption::VALUE_NONE, 'Indicates if the generated model should be a custom intermediate table model'],
            ['resource', 'r', InputOption::VALUE_NONE, 'Indicates if the generated controller should be a resource controller'],
        ];
    }

Source Code

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-28
    • 1970-01-01
    • 2016-02-09
    • 2013-09-05
    • 2011-04-06
    相关资源
    最近更新 更多