public function get($userId) { $query = Book::query(); // TODO Include filtering the results by a list of books the user is not interested in from that author $books = $query->select('books.*')->joinUsersBooks($userId)->notYetPublished()->upcomingPublicationsFirst()->groupBy('user_authors.id')->get(); $books->load('authors.author'); return $books; }