Done a refactor pass on PermissionService

Could do with splitting out into seperate query/build classess really.
Closes #2633.
This commit is contained in:
Dan Brown
2021-03-14 19:52:07 +00:00
parent a644f64c6b
commit 1e5951a75f
6 changed files with 147 additions and 247 deletions

View File

@ -65,7 +65,7 @@ class ViewService
{
$skipCount = $count * $page;
$query = $this->permissionService
->filterRestrictedEntityRelations($this->view, 'views', 'viewable_id', 'viewable_type', $action)
->filterRestrictedEntityRelations($this->view->newQuery(), 'views', 'viewable_id', 'viewable_type', $action)
->select('*', 'viewable_id', 'viewable_type', DB::raw('SUM(views) as view_count'))
->groupBy('viewable_id', 'viewable_type')
->orderBy('view_count', 'desc');