Answers for "write eloquent with() in sql"

PHP
3

DB: in eloquent using sql

$results = DB::select('select * from users where id = :id', ['id' => 1]);
Posted by: Guest on June-11-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

Browse Popular Code Answers by Language