System status now ignores hidden groups for guests - Fixes #2577
This commit is contained in:
@@ -192,6 +192,23 @@ class Component extends Model implements HasPresenter
|
||||
return $query->where('enabled', '=', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find all components which are within visible groups.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param bool $authenticated
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeAuthenticated(Builder $query, $authenticated)
|
||||
{
|
||||
return $query->when(!$authenticated, function (Builder $query) {
|
||||
return $query->whereDoesntHave('group', function (Builder $query) {
|
||||
$query->where('visible', ComponentGroup::VISIBLE_AUTHENTICATED);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds all components which are disabled.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user