Support the ongoing development of Laravel.io →
Eloquent
Last updated 2 years ago.
0

Aaaand.... Just found the answer: Eager loading.

I will just leave this here so if someone is searching for this answer via the same search terms as me, they might be able to find it!

Solution:

$videos = Video::where("videoUserID",$userID)
        ->with('videoAsset')
        ->with('thumbnailAsset')
        ->limit($this->limit)
        ->offset($this->offset)
        ->orderBy("created_at", "desc")
        ->get();

Alternate Solution:

$videos = Video::where("videoUserID",$userID)
        ->with('videoAsset','thumbnailAsset')
        ->limit($this->limit)
        ->offset($this->offset)
        ->orderBy("videoYouTubePublishedAt", "desc")
        ->get();
Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.