Hi,
when using pagination, I get the page numbers in three places, twice just after the body tag (knowing that I am not inserting them there) and that are displayed wrongly and in the correct place. You can see this image for more details. image illustrating the pagination problem
Could you please assist me how to resolve this problem?
Maybe you should post your code so that someone can help you. There is no way to help you without seeing what you have in your code.
The code of the view is as following:
@extends('template')
@section('contenu') <br>
<div class="col-sm-offset-3 col-sm-6">
@if(session()->has('ok'))
<div class="alert alert-success alert-dismissible">{!! session('ok') !!}</div>
@endif
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Liste des produits</h3>
</div>
<table class="table">
<thead>
<tr>
<th>#</th>
<th>Code</th>
<th>Prix régulier</th>
<th>prix promotionnel</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach ($products as $p)
<tr>
<td>{!! $p->id !!}</td>
<td class="text-primary"><strong>{!! $p->code !!}</strong></td>
<td>{!! $p->regular_price !!}</td>
<td>{!! $p->promotion_price !!}</td>
<td>
<td>{!! link_to_route('product', 'Afficher produit', [$p->id], ['class' => 'btn btn-success btn-block']) !!}</td>
{!! Form::close() !!}
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
{!! link_to_route('add-product', 'Ajouter un produit', [], ['class' => 'btn btn-info pull-right']) !!}
{!! $links !!}
</div>
@endsection
The code of the controller is as following:
....
class ProductController extends Controller
{
public function listProducts(){
$nombreProduitsParPage=1;
$product= new Product;
$products=$product->paginate($nombreProduitsParPage);
$links = $products->render();
return view('products_list', compact('products', 'links'));
}
Note that the same code works finely in another project but in this project it generates the wrong links, the things that make me convinced to a some extent that this is a problem of caching or some thing like that!!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community