I have a controller que find the products and return to view . Current i'm trying make the pagination and i'm using the following code :
return $this->queryProductsAvailable()
->where('fornecedores.plano_id', $plano)
->select('produtos.*')
->paginate( $limit );
function queryProductsAvailabe:
private function queryProductsAvailable()
{
return Products::join('fornecedores', 'fornecedores.id', '=' ,'produtos.fornecedor_id')
->where( 'fornecedores.ativo', '1')
->where( 'produtos.moderacao', 'P' )
->where( 'produtos.ativo' , '1' )
->where( 'produtos.preco_min', '>', 0 )
->select( 'produtos.*');
}
To view i'm return the following:
return view('Catalogo.index',
[
'products' => $products
]
);
But when i run the method $products->render()nothing happens.
No errors, no messages...
if i run $products->total() is returned the value 0
if i run $products->nextPageUrl() nothing happens
The same variable used to access this methods is used for the loop and print of products and the foreach works fine.
if i access the url with /?page=2 the pagination works, but not render list of pages.
Any idea?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1riOJgi
via IFTTT
Aucun commentaire:
Enregistrer un commentaire