| 1234567891011121314151617181920212223242526272829303132 |
- <?php
- // +----------------------------------------------------------------------
- // | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2013-present http://www.thinkcmf.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
- // +----------------------------------------------------------------------
- // | Author: 老猫 <thinkcmf@126.com>
- // +----------------------------------------------------------------------
- namespace app\admin\model;
- use app\admin\model\NewsCateModel;
- use think\Model;
- class NewsModel extends Model
- {
- /**
- * 模型名称
- * @var string
- */
- protected $name = 'news';
- public function news_cate()
- {
- return $this->hasOne(NewsCateModel::class, 'id', 'cate_id')
- ->field('id, name')
- ->append([ 'cate_id' ]);
- }
- }
|