1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-07 23:03:00 +03:00

Added favourites page with link from header and home

This commit is contained in:
Dan Brown
2021-05-23 13:34:08 +01:00
parent 27942f5ce8
commit 1e0aa7ee2c
11 changed files with 59 additions and 14 deletions

View File

@@ -1,13 +1,12 @@
<?php namespace BookStack\Entities\Queries;
use BookStack\Actions\View;
use Illuminate\Database\Query\JoinClause;
use Illuminate\Support\Facades\DB;
class TopFavourites extends EntityQuery
{
public function run(int $count, int $page)
public function run(int $count, int $skip = 0)
{
$user = user();
if ($user === null || $user->isDefault()) {
@@ -26,11 +25,10 @@ class TopFavourites extends EntityQuery
->orderBy('view_count', 'desc');
return $query->with('viewable')
->skip($count * ($page - 1))
->skip($skip)
->take($count)
->get()
->pluck('viewable')
->filter();
}
}
}