mtech/module-helper

为使用 Laravel 模块模式的 M-Tech API 项目提供的实用工具

1.0.7 2023-07-17 02:07 UTC

This package is auto-updated.

Last update: 2024-09-17 04:41:22 UTC


README

使用一条命令在模块中创建迁移、模型、契约和存储库的模板

安装

composer require mtech/module-helper --dev

如何使用

php artisan mtech:make-model {module} {table} {model} --meta
php artisan mtech:make-attachment {module} {table} {model}

示例

  • 模型

    php artisan mtech:make-model Voyage voyage_details VoyageDetail
    
  • 元数据:请注意,要创建元数据,请将命令中的 --meta 选项包括在内

    php artisan mtech:make-model Voyage voyage_types VoyageType --meta
    
    • 附件:请注意,第三个变量是这个附件所属的模型。在这个例子中,我们想要创建航行附件,所以第三个变量应该是 航行
    php artisan mtech:make-attachment Voyage voyage_attachments Voyage
    

重要提示

您仍然需要在 Config/config.php 中绑定契约和存储库