123456789101112131415161718192021222324252627282930313233 |
- <?php
- namespace app\common\model;
- class Repo extends Base
- {
- protected $schema = [
- 'id' => 'int',
- 'name' => 'varchar',
- 'desc' => 'varchar',
- 'address' => 'varchar',
- 'create_time' => 'datetime',
- 'update_time' => 'datetime',
- 'delete_time' => 'datetime',
- 'valid' => 'tinyint',
- 'parent' => 'int',
- ];
- 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');
- }
- }
|