Jun 3, 2015
0
Level 1
2 pagination in one page Laravel4
Hello,
i have index page where are 2 tabs. In the contens i loading products and categories with two pagination. then i click on page for ex. 3, pagination together show me 3 page. how to make two links like:
http://domain.com/products/type?page=2
http://domain.com/products/type?page2=2
ps. i can add another variable like {{ $products->appends(['products' => 1])->links() }}
but in the controler after i need check if (Input::get('products') ==1) than first pagination() reset to first page. how to do that?
there is my code;
function getType() {
$perPage = 24;
return View::make('auth/product/order_type')->with(array(
'single_products' => View::make('auth/product/single_products')->with(array(
'categories' => StoreCategories::getCategories(
StoreCategories::where('user_id', Auth::user()->main_id)
->whereNotExists(function($query)
{
$query->select(DB::raw(1))
->from('store_products')
->whereRaw('store_products.store_product_id = store_product.id');
})
->orderBy('id', 'desc')->paginate($perPage)
)
)),
'store_products' => View::make('auth/product/store_products')->with(array(
'products' => StoreProduct::getProducts(
StoreProduct::where('user_id', Auth::user()->main_id)
->whereExists(function($query)
{
$query->select(DB::raw(1))
->from('store_products')
->whereRaw('store_products.store_product_id = store_product.id');
})
->orderBy('id', 'desc')->paginate($perPage)
)
)),
));
}
EDITED:
or how to on click tab and reset to page1: there is html
<a href="#single-products" role="tab" data-toggle="tab">Single products</a>
Please or to participate in this conversation.