Skip to content

Commit ccb9874

Browse files
authored
Fix: Update withAuthorInfo() to use plural table names
The `BookModel::withAuthorInfo()` method in the Controller guide uses singular table names (book, author) instead of the plural names (books, authors) created in the Database Setup migration. Fixes #10057
1 parent fa57ec7 commit ccb9874

File tree

1 file changed

+3
-3
lines changed
  • user_guide_src/source/guides/api/code

1 file changed

+3
-3
lines changed

user_guide_src/source/guides/api/code/013.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ class BookModel extends Model
1515
*/
1616
public function withAuthorInfo()
1717
{
18-
return $this
19-
->select('book.*, author.id as author_id, author.name as author_name')
20-
->join('author', 'book.author_id = author.id');
18+
return $this
19+
->select('books.*, authors.name as author_name')
20+
->join('authors', 'books.author_id = authors.id');
2121
}
2222
}

0 commit comments

Comments
 (0)