Wpis z mikrobloga

@normanos:

User

pubf articles(){

return $this->hasMany('Article');

}

pubf comments(){

return $this->hasMany('Comment');

}

Comment

pubf user(){

return $this->belongsTo('User');

}

pubf article(){

return $this->belongsTo('Article');

}

Article

pubf user(){

return $this->belongsTo('User');

}

pubf comments(){

return $this->hasMany('Comment');

}

W skrócie tak to jest. I teraz jak chcę wczytać komentarze, lub filmy to robię to tak:

$comments = Comments::where('user_id', '=', $id)->paginate(15);