mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
Fix Books and Console pages
This commit is contained in:
@@ -5,12 +5,15 @@ namespace App\Http\Controllers;
|
||||
use Blacklight\Books;
|
||||
use App\Models\Category;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
|
||||
class BooksController extends BasePageController
|
||||
{
|
||||
/**
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function index(Request $request, $id = '')
|
||||
@@ -49,15 +52,16 @@ class BooksController extends BasePageController
|
||||
|
||||
$books = [];
|
||||
$page = $request->has('page') ? $request->input('page') : 1;
|
||||
$results = $book->getBookRange($page, $catarray, $orderby, $this->userdata['categoryexclusions']);
|
||||
|
||||
$offset = ($page - 1) * config('nntmux.items_per_cover_page');
|
||||
$rslt = $book->getBookRange($page, $catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, $this->userdata['categoryexclusions']);
|
||||
$results = new LengthAwarePaginator($rslt, $rslt['_totalcount'], config('nntmux.items_per_cover_page'), $page, ['path' => $request->url()]);
|
||||
$maxwords = 50;
|
||||
foreach ($results as $result) {
|
||||
if (! empty($result['overview'])) {
|
||||
$words = explode(' ', $result['overview']);
|
||||
if (! empty($result->overview)) {
|
||||
$words = explode(' ', $result->overview);
|
||||
if (\count($words) > $maxwords) {
|
||||
$newwords = \array_slice($words, 0, $maxwords);
|
||||
$result['overview'] = implode(' ', $newwords).'...';
|
||||
$result->overview = implode(' ', $newwords).'...';
|
||||
}
|
||||
}
|
||||
$books[] = $result;
|
||||
|
||||
Reference in New Issue
Block a user