Implemented functionality to make books sort function

Also changed public user settings to be stored in session rather than DB.
Cleaned existing list view type logic.
This commit is contained in:
Dan Brown
2018-12-07 18:33:32 +00:00
parent 0b976d9f91
commit 4c574c22a8
16 changed files with 218 additions and 47 deletions

View File

@ -102,6 +102,11 @@ class Entity extends Ownable
return $this->morphMany(View::class, 'viewable');
}
public function viewCountQuery()
{
return $this->views()->selectRaw('viewable_id, sum(views) as view_count')->groupBy('viewable_id');
}
/**
* Get the Tag models that have been user assigned to this entity.
* @return \Illuminate\Database\Eloquent\Relations\MorphMany