Made books and shelf listing views slightly more efficient
This commit is contained in:
		
							parent
							
								
									d0a7a8b890
								
							
						
					
					
						commit
						da7c686541
					
				| 
						 | 
					@ -35,7 +35,7 @@ class BookRepo
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public function getAllPaginated(int $count = 20, string $sort = 'name', string $order = 'asc'): LengthAwarePaginator
 | 
					    public function getAllPaginated(int $count = 20, string $sort = 'name', string $order = 'asc'): LengthAwarePaginator
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return Book::visible()->orderBy($sort, $order)->paginate($count);
 | 
					        return Book::visible()->with('cover')->orderBy($sort, $order)->paginate($count);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,7 +30,7 @@ class BookshelfRepo
 | 
				
			||||||
    public function getAllPaginated(int $count = 20, string $sort = 'name', string $order = 'asc'): LengthAwarePaginator
 | 
					    public function getAllPaginated(int $count = 20, string $sort = 'name', string $order = 'asc'): LengthAwarePaginator
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return Bookshelf::visible()
 | 
					        return Bookshelf::visible()
 | 
				
			||||||
            ->with('visibleBooks')
 | 
					            ->with(['visibleBooks', 'cover'])
 | 
				
			||||||
            ->orderBy($sort, $order)
 | 
					            ->orderBy($sort, $order)
 | 
				
			||||||
            ->paginate($count);
 | 
					            ->paginate($count);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue