*/
public function index()
{
- $books = $this->bookRepo->getAll();
+ $books = $this->bookRepo->getAll(10);
$activity = $this->activityService->latest();
return view('home', ['books' => $books, 'activity' => $activity]);
}
return $this->book->findOrFail($id);
}
- public function getAll()
+ public function getAll($count = 10)
{
- return $this->book->all();
+ return $this->book->orderBy('name', 'asc')->take($count)->get();
}
/**
@include('books/list-item', ['book' => $book])
<hr>
@endforeach
+ @if(count($books) === 10)
+ <a href="/books">View all books »</a>
+ @endif
@else
<p class="text-muted">No books have been created.</p>
<a href="/books/create" class="text-pos"><i class="zmdi zmdi-edit"></i>Create one now</a>