Skip to content

PHP code snippet – How to display all posts assocatied to user in laravel?

class User extends Eloquent {

    public function posts() {
        return $this->hasMany('Post');


// in order to show it you need to do that in your blade file
See also  Python code snippet - How to get a specific key in a dictionary ?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.