Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Laravel 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: #Laravel #eager #loading
ADD COMMENT
Topic
Name
4+9 =