Answer the question
In order to leave comments, you need to log in
Laravel. What is "eager loading" in a nutshell?
That's the whole question. Hi all!
Answer the question
In order to leave comments, you need to log in
In the documentation, everything is simply painted.
There is a model:
namespace App;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
/**
* Get the phone record associated with the user.
*/
public function phone()
{
return $this->hasOne('App\Phone');
}
}
foreach($users as $user){
$phone = $user->phone;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question