first commit
This commit is contained in:
25
金壶/ydyd_service/application/common/model/AreaModel.php
Normal file
25
金壶/ydyd_service/application/common/model/AreaModel.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: typ
|
||||
* Date: 2019/1/3
|
||||
* Time: 14:45
|
||||
*/
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class AreaModel extends Model
|
||||
{
|
||||
|
||||
public function parent()
|
||||
{
|
||||
return $this->belongsTo(AreaModel::class, 'parent_area_id')->field('id, area_name, parent_area_id');
|
||||
}
|
||||
|
||||
public function childs()
|
||||
{
|
||||
return $this->hasMany(AreaModel::class, 'parent_area_id')->field('id, area_name, parent_area_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user