I have a question about the dynamic relationship properties, suppose there are user
and address
model.
public function address(){
return $this->hasMany(Address::class);
}
I want to ask $user->address
will cause N+1 problems , therefore, we may use eager load, but when I call $user->address()->get()
will also cause N+1 problems, is it a good performance?
Another question is that what is the better way to get the list of address with specific user?
I want to get only the address data without the user data, therefore, I dont want to use eager load.