Something like this?
$messages = Message::with('author','author.primaryPhoto')->where('user_id', '=', $loggedInUserId)->get();
User.php
public function primaryPhoto()
{
return $this->hasOne('Photo')->where('photos.position', '=', 0);
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community