Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

eager loading

public function format(Book $book)
{
    $book->loadMissing('author');
 
    return [
        'name' => $book->name,
        'author' => $book->author->name,
    ];
}
Source by laravel.com #
 
PREVIOUS NEXT
Tagged: #eager #loading
ADD COMMENT
Topic
Name
9+7 =