Search code examples
csstwitter-bootstrappaginationtwitter-bootstrap-3laravel-3

Laravel 3 paginate not formatted correctly with Bootstrap 3


I am trying to paginate data from a database using laravel. My code is as follows:

    echo "<table class='table table-striped table-hover'><tbody>";
       $orders=DB::table('customers')->paginate(7);
       foreach ($orders->results as $order):
          echo "<tr><td>".$order->name."</td>
          <td> <button type='button' class='btn btn-sm btn-success pull-right'>
Edit</button></td>
          <td><button type='button' class='btn btn-sm btn-danger pull-right'>
Delete</button></td></tr>"; 
       endforeach; 
    echo "</table>";
       echo $orders->links();

This outputs the paginate links in different lines like so:

« Previous
1
2
Next »

Is it because there is a conflict with bootstrap3? Any help is highly appreciated.


Solution

  • Although not the best way to handle it, I managed to solve the problem. My solution requires editing the paginator.php inside the vendor folder. Changing

    return '<div class="pagination">'.$content.'</div>';
    

    on line 188 to

    return $content;
    

    solves the problem.