我有这个 Laravel 范围代码
public function apply(Builder $builder, Model $model)
{
$builder->whereDoesntHave('getPermissionData');
}
到目前为止一切正常,我需要的是改善这样的条件
public function apply(Builder $builder, Model $model)
{
/*
if($builder->whereHas('getPermissionData'))
{
check the relation
and do some code here
}
*/
$builder->whereDoesntHave('getPermissionData');
}
这可能吗