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

You can load the relation and then use the object loaded

$order->load(['user.profile']);
$order->user->profile->first_name;
$order->user->profile->last_name;

or you can use query builder instead.

0

Thanks, but I get this error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'users.order_id' in 'where clause' (SQL: select * from users where users.order_id in (1))

0

Sign in to participate in this thread!

Eventy

Your banner here too?

SigalZ sigalz Joined 5 May 2016

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.