コード例 #1
0
 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;
 }
コード例 #2
0
 protected function addBook(array $book, string $googleBookId)
 {
     return Book::create(['title' => $book['title'], 'subtitle' => $book['subtitle'], 'description' => $book['description'], 'publisher' => $book['publisher'], 'published_date' => $book['publishedDate'], 'google_books_id' => $googleBookId]);
 }