how to display all posts assocatied to user in laravel

40

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
{{Auth::user()->posts}}

Comments

Submit
0 Comments