title: i can't listing users' post in theirs profile. i use one to many relationship in User model
body: <p><em><strong>//here is my controller</strong></em> `</p>
  <p>public function index($id){</p>
  <pre><code>    $users=User::where('id',$id)-&gt;get();
  
      return view('user',compact('users'));
  
  }
  </code></pre>
  <p>}`</p>
  <p><em><strong>//here is my User model</strong></em></p>
  <pre><code>   public function getPosts()
  {
      return $this-&gt;hasMany('App\Post','user_id','id');
  }
  </code></pre>
  <p><em><strong>//here is my user blade</strong></em></p>
  <pre><code> @foreach($user-&gt;getPosts as $post)
          &lt;div class=&quot;profile-content&quot;&gt;
              &lt;section class=&quot;post-heading&quot;&gt;
                  &lt;div class=&quot;rows&quot;&gt;
                      &lt;div class=&quot;col-md-11&quot;&gt;
  
                          &lt;div class=&quot;media&quot;&gt;
                              &lt;div class=&quot;media-left&quot;&gt;
                                  &lt;a href=&quot;#&quot;&gt;
                                      &lt;img class=&quot;media-object photo-profile&quot; src=&quot;https://scontent.fgyd4-2.fna.fbcdn.net/v/t1.0-9/p960x960/73248174_2597397730318615_6397819353256951808_o.jpg?_nc_cat=109&amp;_nc_sid=7aed08&amp;_nc_ohc=VxH_cAqJ778AX_7B97W&amp;_nc_ht=scontent.fgyd4-2.fna&amp;_nc_tp=6&amp;oh=e5b02c7f91818664cf253e71f2ddf106&amp;oe=5F5F4E74&quot; width=&quot;40&quot; height=&quot;40&quot; alt=&quot;...&quot;&gt;
                                  &lt;/a&gt;
                              &lt;/div&gt;
                              &lt;div class=&quot;media-body&quot;&gt;
                                  &lt;a href=&quot;/users&quot; class=&quot;anchor-username&quot;&gt;&lt;h4 class=&quot;media-heading&quot;&gt;{{$user-&gt;name}} &lt;/h4&gt;&lt;/a&gt;
                                  &lt;a href=&quot;#&quot; class=&quot;anchor-time&quot;&gt;{{$user-&gt;$post['created_at']}}&lt;/a&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class=&quot;col-md-1&quot;&gt;
                          &lt;a href=&quot;#&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-chevron-down&quot;&gt;&lt;/i&gt;&lt;/a&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
  
              &lt;/section&gt;
  
  
              &lt;section class=&quot;post-body&quot;&gt;
  
                  &lt;p&gt;{{  $user-&gt;getPost-&gt;post['post_description']  }}&lt;/p&gt; &lt;!--  i stick around here --&gt;
              &lt;/section&gt;
  </code></pre>
  <p><em><strong>//it give this error to me</strong></em></p>
  <p><strong>Property [getPosts] does not exist on this collection instance. (View: C:\xampp\htdocs\site\resources\views\user.blade.php)</strong></p>