1234567891011121314151617181920212223242526 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Administrator
- * Date: 2020-09-18
- * Time: 11:28
- */
-
- namespace api\js\model;
-
-
- use think\Model;
- class PortalCategoryModel extends Model
- {
- public function portal()
- {
-
- return $this->belongsToMany('PortalPostModel','portal_category_post','post_id','category_id')->alias('a')->order('a.id','desc')->field('a.id,a.post_title,post_excerpt,update_time');
- }
- public function getlist($id=1)
- {
- $list = $this::get($id,['portal'=>function($query){$query->where(['delete_time'=>0,'post_status'=>1]);}]);
- return $list->portal;
- }
- }
|