public static function detail($company_id)
{
$model = (new static)->with(['comment'])
->where('company_id', '=', $company_id)
->find();
return $model;
}
/**
* 关联评价
* @return \think\model\relation\HasOne
*/
public function comment()
{
return $this->hasMany("app\\common\\model\\TaskComment", 'company_id', 'company_id');
}我想在关联的comment模型里面加上条件is_delete=0,不知道怎么加,请前辈告知,用(new static)->hasWhere('comment',['is_delete'=>0]) 不行,报错的
最佳答案