I'm sorry. I thought about it but I can't come to a better title since I don't know how to describe this problem in one sentence.
Anyway, I am building a news feed just as Facebook where users can post a wall message and other users can comment on it.
I have 3 Tables in the database
profiles
Table which contains the file name for their profile picture. posts
table which contains details about posts and comments
table for comments.
I have the below code in my Post
model
public $belongsTo = 'Profile';
public $hasMany = 'Comment';
by doing that I can get the comments associated with each posts. But I am not able to get the profile picture from profiles
table for "commenter". I tried
public $belongsTo = 'Profile;
in the Comment
model too but it's not working.