-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Expand file tree
/
Copy pathBooksIndexNew.php
More file actions
31 lines (25 loc) · 747 Bytes
/
Copy pathBooksIndexNew.php
File metadata and controls
31 lines (25 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
namespace BookStack\View\ViewBlocks;
use BookStack\Entities\Queries\BookQueries;
use BookStack\View\ViewBlock;
use Illuminate\Http\Request;
class BooksIndexNew extends ViewBlock
{
protected static string $id = 'builtin_books-index-new';
protected static string $view = 'books.parts.index-sidebar-section-new';
protected static string $labelTranslationKey = 'entities.books_new';
public function __construct(
protected BookQueries $queries,
) {
}
public function withData(array $viewData): array
{
$new = $this->queries->visibleForList()
->orderBy('created_at', 'desc')
->take(4)
->get();
return [
'new' => $new,
];
}
}