Question : eager loading
Answered by : ahmet-ayhan
public function format(Book $book)
{ $book->loadMissing('author');
return [ 'name' => $book->name, 'author' => $book->author->name, ];
}
Source : https://laravel.com/docs/7.x/eloquent-relationships#eager-loading | Last Update : Mon, 24 Oct 22
Question : Eager Loading
Answered by : frantic-frog-wiropt0id1xm
const userDetail = await User.findOne({ where: { email: "[email protected]" }, include: Account });
Source : https://javascript.plainenglish.io/four-sequelize-associations-you-should-know-415d8d413e1e | Last Update : Fri, 27 May 22