1
When I create a pagination manually, it is giving error, it does not create in the view the amount of exact elements as I determine.
On my controller:
public function getIndex(){
$fileClass = FileClass::with(['FileServico'])
->where('status','=','PR')
->where('id_cliente','=',1)
->orderBy('id_file','DESC')
->get()
->toArray();
foreach($fileClass as $fileArr){
foreach($fileArr['file_servico'] as $file){
$f[] = $file;
}
}
return View::make('home')
->with('fileClass',Paginator::make($f, count($f),2));
}
In the view I do the iteration normally to print the data and the data is printed, the pager is normally created at the bottom and does the exact count as I determine, however, the table that is created does not bring back the exact elements.
@foreach($fileClass as $f)
<tr>
<td>{{ $f['id_file'] }}</td>
</tr>
@endforeach
And the pager is right, it usually appears:
@section('pagination')
<section id="pagination">
{{ $fileClass->links() }}
</section>
@stop
When printing the amount of elements per page it prints all the elements, below is presented the pager normally, but there is no pagination itself.
I solved my problem through this tutorial: https://arjunphp.com/laravel-5-pagination-array/ might be useful.
– Jilcimar Fernandes