I have two tables user and profile. Profile table had user_id as foreign key. I have related the two tables.
In tinker I can see that relation is made but in code its not fetching the details from other table.
I have also tried
return $this->belongsTo('User::class');
User Model
public function profile() {
return $this->hasOne('Profile');
}
Profile Model
public function user() {
return $this->belongsTo('User');
}