Answers for "laravel eloquent with method"

PHP
1

laravel eloquent with

$books = Book::with(['author', 'publisher'])->get();
Posted by: Guest on June-29-2021
1

laravel model::query

// Eloquent's Model::query() returns the query builder

Model::where()->get();
// Is the same as 
Model::query()->where()->get();

Model::query();
// Can be useful to add query conditions based on certain requirements

// See https://stackoverflow.com/questions/51517203/what-is-the-meaning-of-eloquents-modelquery
Posted by: Guest on October-06-2020
0

laravel eloquent with

$users = User::with('podcasts')->get();

foreach ($users->flatMap->podcasts as $podcast) {
    echo $podcast->subscription->created_at;
}
Posted by: Guest on June-29-2021

Code answers related to "laravel eloquent with method"

Browse Popular Code Answers by Language