title: Laravel 5.4 Pagination
body: <p>I would like to add pagination to my admin index page with children ordered by id desc.
  here is the index method in ChildrenController:</p>
  
  <pre><code>public function index()
  {
      // $children = Child::orderBy('id', 'desc')-&gt;get();
      // $children = $children-&gt;paginate(50);
      $children = Child::paginate(50);
      return view('welcome', compact('children'));
  }
  </code></pre>
  
  <p>so how can I paginate the result of this query </p>
  
  <p>$children = Child::orderBy('id', 'desc')->get();</p>
  
  <p>this is the view code:</p>
  
  <pre><code>@section('content')
  
      @foreach($children as $child)
  
          @include('children.child')
  
      @endforeach
  
      {{ $children-&gt;links() }}
  
  @endsection
  </code></pre>
  
  <p>and this is the actual view which is not sexy:</p>
  
  <p><a href="https://i.stack.imgur.com/0Fkpt.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0Fkpt.jpg" alt="enter image description here"></a></p>
  
  <p>I would like to have it like this:</p>
  
  <p><a href="https://i.stack.imgur.com/gFk1Z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gFk1Z.png" alt="enter image description here"></a></p>