title: How to use pagination along with laravel eloquent find method in laravel 5.4
body: <p>I am trying to implement pagination in laravel and got following error </p>
  
  <pre><code>Undefined property: Illuminate\Pagination\LengthAwarePaginator::$name
  </code></pre>
  
  <p>Here is my controller function</p>
  
  <pre><code>public function showTags($id)
  {
      $tag = Tag::find($id)-&gt;paginate(5);
  
      // when lazy loading
      $tag-&gt;load(['posts' =&gt; function ($q) {
          $q-&gt;orderBy('id', 'desc');
      }]);
  
      return view('blog.showtags')-&gt;withTag($tag);
  }
  </code></pre>
  
  <p>Here is the Tag Model</p>
  
  <pre><code>class Tag extends Model
  {
      public function posts() 
      {
          return $this-&gt;belongsToMany('App\Post');
      }
  }
  </code></pre>
  
  <p>The Tag and Post model has belongsToMany Relationship so there are many posts under the specific tag and my aim is to iterate all posts under the specific tags descending order of post and also to implement pagination in that page.</p>
  
  <p>Here is the code for showtags view</p>
  
  <pre><code>&lt;table class="table"&gt;
      &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;#&lt;/th&gt;
          &lt;th&gt;Title&lt;/th&gt;
          &lt;th&gt;Tags&lt;/th&gt;
      &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
      &lt;?php $count = 1; ?&gt;
      @foreach($tag-&gt;posts as $post)
          &lt;tr&gt;
              &lt;th&gt;{{ $count++ }}&lt;/th&gt;
              &lt;th&gt;{{ $post-&gt;title }}&lt;/th&gt;
              &lt;th&gt;@foreach($post-&gt;tags as $tag)
                      &lt;span class="label label-default"&gt;{{ $tag-&gt;name }}&lt;/span&gt;
                  @endforeach
              &lt;/th&gt;
          &lt;/tr&gt;
      @endforeach
      &lt;/tbody&gt;
  &lt;/table&gt;
  
  //Here is the code i used for pagination in view
  &lt;div class="text-center"&gt;
      {!! $tag-&gt;posts-&gt;links() !!}
  &lt;/div&gt;
  </code></pre>
  
  <p>If anybody know how to do this please respond. Thanks in advance.</p>