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;

 

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