如何将CRUD生成器应用于Laravel模块架构?

时间:2019-03-29 04:48:29

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

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

php artisan module:make leave

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

1 个答案:

答案 0 :(得分:0)

如果您尝试制作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