Laravel 5.0 Pagination render() method return HTML text

azamuddin picture azamuddin · Apr 19, 2015 · Viewed 8k times · Source

I have a controller which send some product to the view. In the controller I paginated the data using

...
// Controller code

Product::paginate(1) // because I only have 2 dummy data, 1 product per page
return view('product.index', compact('product'));

...

then in my product.index view I have the following code:

    <!-- Pagination link -->
    [[ $products->render() ]]
    <!-- End Paginatin link -->

The code works, but it return the HTML without being rendered by the browser as element. The resulting output is like below

<ul class="pagination"><li class="disabled"><span>«</span></li> <li class="acti![enter image description here][2]ve"><span>1</span></li><li><a href="http://localhost:3000/paketsoal/public/dashboard/my-product/?page=2">2</a></li> <li><a href="http://localhost:3000/paketsoal/public/dashboard/my-product/?page=2" rel="next">»</a></li></ul>

enter image description here

Answer

Limon Monte picture Limon Monte · Apr 19, 2015

You should use unescaped block {!! !!}:

{!! $products->render() !!}