fastadmin 搜索时怎么让id唯一搜索,以及关联表时报错的解决办法

以前是这样写的

不过看了文档才知道只需要在

    protected $model = null;
    protected $relationSearch=true;
    public function _initialize()
    {
        parent::_initialize();
        $this->model = new \app\admin\model\ads\Ads;
        $position=db('ads_position')->select();
        $apps=db('apps')->where(['status'=>1])->select();
        $this->assign('apps',$apps);
        $this->assign('position',$position);
    }

只需要添加一句就可以了

protected $relationSearch=true;

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章