lokat / lb-domain-maker
由 rappasoft 创建的 laravel-boilerplate 的域模型/控制器/迁移
v1.0.4
2023-08-23 06:00 UTC
README
在提供的域中创建模型、迁移、控制器
要求
安装
composer require lokat/lb-domain-maker
运行
在您的 Laravel 项目根目录中
php artisan domain:make Example
命令将在 app/Domains/Example/Models 文件夹中创建一个名为 Example 的模型。
选项
您可以通过使用 --migrate 选项运行命令来创建域并运行迁移
php artisan domain:make Example --migration
or
php artisan domain:make Example -m
您也可以通过使用 --model 选项运行命令来指定模型的名称
php artisan domain:make Example --model=ModelName
or
php artisan domain:make Example -M ModelName
如果您想创建控制器,请使用 --controller 选项运行命令
php artisan domain:make Example --controller
or
php artisan domain:make Example -c
控制器将在 app/Domains/Example/Http/Controllers/Backend/ExampleController 创建
您还可以通过使用 --frontend 选项运行命令来创建前端控制器
php artisan domain:make Example --controller --frontend
or
php artisan domain:make Example -c -f
您也可以通过使用 --resource 选项运行命令来创建带有资源的控制器
php artisan domain:make Example --resource
or
php artisan domain:make Example -r
如果您想创建不带模型的控制器,请使用 --no-model 选项运行命令
php artisan domain:make Example --controller --no-model
or
php artisan domain:make Example -cN
添加服务
php artisan domain:make Example --service
or
php artisan domain:make Example -s
它将在以下位置创建服务
app/Domains/Example/Services/ExampleService.php
添加观察者
php artisan domain:make Example --observer
or
php artisan domain:make Example -o
它将在以下位置创建观察者
app/Domains/Example/Observers/ExampleObserver.php
添加模型资源
php artisan domain:make Example --model-resource
or
php artisan domain:make Example -R
它将在以下位置创建模型资源
app/Domains/Example/Resources/ExampleResource.php
添加请求
php artisan domain:make Example --request
or
php artisan domain:make Example -t
它将在以下位置创建 2 个表单请求
app/Domains/Example/Requests/ExampleStoreRequest.php
app/Domains/Example/Requests/ExampleUpdateRequest.php
添加 livewire 数据表
php artisan domain:make Example --datatable
or
php artisan domain:make Example -d
它将在以下位置创建 2 个 livewire 数据表
app/Domains/Example/Livewire/Frontend/ExamplesTable.php
app/Domains/Example/Livewire/Backend/ExamplesTable.php