b3nl/laravel-mwb-model

将 MySQL Workbench 模型转换为 Laravel 对应的模型。

0.10.0 2016-03-13 19:31 UTC

This package is auto-updated.

Last update: 2024-09-16 06:12:47 UTC


README

使用此项目,您可以启动 Laravel 5 项目的模型和数据库迁移。目前还不能更新,只是开始。

  • 只需将此项目添加到您的 composer 配置中:"b3nl/laravel-mwb-model": "dev-master"
  • 将我们的服务提供者添加到 config/app.php 中的服务提供者列表:b3nl\MWBModel\ServiceProvider::class

现在您可以使用 artisan 命令解析您的 MySQL-Workbench-File

php artisan make:mwb-model $FILE_TO_SAVED_MODEL --pivots=$COMMA_SEPARATED_LIST_OF_YOUR_PIVOT_TABLE_NAMES

特殊表注释

您可以使用以下选项的 ini-String 在 MySQL-Workbrench 中注释您的表

; With this comment, this table is ignored for parsing. Leave it out, if you do not want it ignored.
ignore=true
; Name of the Laravel model 
model=Name
; Is this a pivot table? Leave it out if not.
isPivot=true
; withoutTimestamps removes the default timestamps() call for the database migrations
withoutTimestamps=true
; Ini-Array for the laravel model castings: https://laravel.net.cn/docs/5.1/eloquent-mutators#attribute-casting
[casting]
values=array