123456789101112131415161718192021222324252627282930313233 |
- <?php
- namespace app\common\model;
- class Repo extends Base
- {
- protected $schema = [
- 'id' => 'int', // id
- 'name' => 'varchar', // 仓库名称
- 'desc' => 'varchar', // 仓库说明
- 'address' => 'varchar', // 仓库地址
- 'create_time' => 'datetime', // 创建时间
- 'update_time' => 'datetime', // 更新时间
- 'delete_time' => 'datetime', // 删除时间
- 'valid' => 'tinyint', // 状态,1启用,0禁用
- 'parent' => 'int', // 父仓库id
- ];
- public function logs()
- {
- return $this->hasMany(Repo::class);
- }
- public function parent()
- {
- return $this->belongsTo(Repo::class, 'id', 'parent');
- }
- public function children()
- {
- return $this->hasMany(Repo::class, 'parent', 'id');
- }
- }
|