Im new to laravel 5.2. I just want to ask how to add paginations inside tabs. In my interface there are 5 tabs and eack tab is displaying separate 5 tables from the database. And the database which i using is oracle. In my interface i have added paginatiins for the first tab and it worked successfully.(i added simplepagination method)
But when i adding same method to second tab pagination appeared and when i click the next button on that pagination it directed to the 2nd page of 1st tab not the 2nd page of second tab. I'll be really thankfull if some one can help me to solve this
Thank you
I' assuming you are using Pagination
And you can do:
$allUser = User::paginate(2, ['*'], 'user');
$allRole = Role::paginate(2, ['*'], 'role');
return response()->json(array($allUser,$allRole));
Now you get something like:
[
{
"total": 17,
"per_page": 2,
"current_page": 1,
"last_page": 9,
"next_page_url": "http://urlsite/api/v1/user?user=2",
"prev_page_url": null,
"from": 1,
"to": 2,
"data": [
{
"id": 1,
"role_id": 1,
"username": "test",
"first_name": "test",
"last_name": "test",
"email": "test@gmail.com"
},
{
"id": 2,
"role_id": 2,
"username": "test2",
"first_name": "test",
"last_name": "test",
"email": "test@hotmail.com"
}
]
},
{
"total": 4,
"per_page": 2,
"current_page": 1,
"last_page": 2,
"next_page_url": "http://urlsite/api/v1/user?role=2",
"prev_page_url": null,
"from": 1,
"to": 2,
"data": [
{
"id": 1,
"name": "superuser"
},
{
"id": 2,
"name": "administrator"
}
]
}
]
i have solved this by using below methods thanks for the help
in my controller
public function index()
{
$para_id=false;
$data_para=Input::all();
if($data_para){
$para_id=$data_para['pagetype'];
}
$balances=DB::table('in_balances')->simplePaginate(5,['*'],'balances');
$balances->setPath('/in-parameter/parameter?pagetype=1');
}
return view('in-parameter.parameter',
['balances'=>$balances,
'para_id'=>$para_id]);
in my blade.php Balance
{!! Form::open(array('url' => 'in-parameter/parameter', 'class' => 'form-inline', 'method' => 'post')) !!}
-------------------------------------
-------------------------------------
------------------------------------
{!! Form::close() !!}
<div class="pagination"> {{ $balances->links() }} </div>