Have you assigned the Comment -> User relationship? For instance..
class Comment {
public function Author(){
return $this->belongsTo('User');
}
}
class User {
public function Comments(){
return $this->hasMany('Comment');
}
}
Then, when pulling a single $comment object, you'd be able to do
$comment->author->username
thank you, now i understand how to use eloquent on my project.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community