Support the ongoing development of Laravel.io →
Input Database Eloquent
Last updated 1 year ago.
0

I am not sure, I haven't seen anyone doing it, in Profile class, why you pass same parameter twice in photo method? user_id. SHould be passed one, right?

public function photo()
{
return $this->hasMany('Photo','user_id','user_id');
}

and I am not sure, but I prefer, maybe Try passing second parameter in profile()

 public function profile()
{
return $this->hasOne('Profile','user_id');
}
Last updated 1 year 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.