qsun / model-annotation
此包已被废弃,不再维护。未建议替代包。
dev-master
2020-02-17 21:29 UTC
Requires
- php: >=5.3.2
- laravel/framework: >=5.2.0
This package is auto-updated.
Last update: 2022-01-18 01:54:06 UTC
README
ModelAnnotation 将数据库模式与模型文件分开,以便于轻松引用。
向纯 Laravel 模型文件添加注释
<?php
/* MODEL ANNOTATION:
@property $id Type: bigint(20) unsigned Extra: auto_increment Default: null Key: PRI
@property $name Type: varchar(255) Extra: Default: null Key: nil
@property $email Type: varchar(255) Extra: Default: null Key: UNI
@property $email_verified_at Type: timestamp Extra: Default: null Key: nil
@property $password Type: varchar(255) Extra: Default: null Key: nil
@property $remember_token Type: varchar(100) Extra: Default: null Key: nil
@property $created_at Type: timestamp Extra: Default: null Key: nil
@property $updated_at Type: timestamp Extra: Default: null Key: nil
END MODEL ANNOTATION */
namespace App;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
/**
用法
目前此包仅支持 MySQL。
-
确保您有备份或版本控制工具(VCS).
-
修改 composer.json 文件,在
require
部分添加以下行
"require": {
...
"qsun/model-annotation": "dev-master"
}
-
运行
composer update
安装新添加的包 -
在
app.php
中添加Service Provider
'providers' => [
....
qsun\ModelAnnotation\AnnotationServiceProvider::class
]
- 运行
php artisan annotate:models
以添加注释到模型文件