I have 3 table with this fields :
User:
id
name
address
Employee:
id
user_id
Profile:
id
employee_id
how can i associate user->name
from Profile
model
class Profile extends Model
{
public function employee()
{
return $this->belongsTo('App\Employee', 'employee_id');
}
public function user()
{
return $this->belongsTo('App\User', $employee->user_id);
}
}
The user()
function is obviously wrong, T'm trying to get the user data from the Profile
. what is the proper way to do this?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2KLKx56
via IFTTT
Aucun commentaire:
Enregistrer un commentaire