Laravel 4 pagination - Can't get past page 1 -
i have created of search feature, user can choose type, pool, date , time. can't seem make paginator work, when click on page 2 results disappear.
i have tried append $query->links() function, none of tries have yet succeeded.
the url looks this: http://localhost:8080/nih/public/bassengweb/data?time_maling=1&pool_id=1&fradato=14%2f04%2f2014&tildato=22%2f04%2f2014&fratid=00%3a01&tiltid=23%3a59
the code view file:
@extends('default') @section('content') <h1>admin sØk</h1> {{ form::open(array('url' => 'bassengweb/data', 'method' => 'get')) }} <table> <tr> <td>{{ form::label('time_maling', 'timemåling') }}</td> <td>{{ form::checkbox('time_maling', 1) }}</td> <td>{{ form::label('3_time_maling', '3. timemåling') }}</td> <td>{{ form::checkbox('3_time_maling', 1) }}</td> <td>{{ form::label('oppgaver', 'oppgaver') }}</td> <td>{{ form::checkbox('oppgaver', 1) }}</td> <td>{{ form::label('pool_id', 'basseng') }}</td> <td>{{ form::select('pool_id', $pools, input::old('pool_id')) }}</td> </tr> <tr> <td>{{ form::label('dagsoppg', 'dagvakt') }}</td> <td>{{ form::checkbox('dagsoppg', 1) }}</td> <td>{{ form::label('kveldsoppg', 'kveldsvakt') }}</td> <td>{{ form::checkbox('kveldsoppg', 1) }}</td> <td>{{ form::label('helgoppg', 'helgevakt') }}</td> <td>{{ form::checkbox('helgsoppg', 1) }}</td> </tr> <tr> <td>{{ form::label('kontcm', 'kontroll cm') }}</td> <td>{{ form::checkbox('kontcm', 1) }}</td> <td>{{ form::label('arduino', 'arduino') }}</td> <td>{{ form::checkbox('arduino', 1) }}</td> <td><hr/></td> </tr> <tr> <td>{{ form::label('fradato', 'fra dato: ') }}</td> <td>{{ form::text('fradato', input::old('fradato'), array('placeholder' => $date)) }}</td> <td>{{ form::label('tildato', 'til dato: ') }}</td> <td>{{ form::text('tildato', input::old('tildato'), array('placeholder' => $date)) }}</td> </tr> <tr> <td>{{ form::label('fratid', 'fra klokka: ') }}</td> <td>{{ form::text('fratid', input::old('fratid'), array('placeholder' => '10:55:31')) }}</td> <td>{{ form::label('tiltid', 'til klokka: ') }}</td> <td>{{ form::text('tiltid', input::old('tiltid'), array('placeholder' => '10:55:31')) }}</td> <td>{{ form::submit('søk') }}<td> </tr> </table> {{ form::close() }} @if(isset($data)) <table class='table table-hover'> <tr> <td>id</td> <td>tittel</td> <td>verdi</td> <td>ansatt id</td> <td>dato</td> <td>tid</td> @if($type === 'measurement') <td>basseng</td> </tr> @foreach($data $dataitem) <tr> <td>{{ $dataitem->id }}</td> <td>{{ $dataitem->measurements[0]->title }}</td> <td>{{ $dataitem->value }}</td> <td>{{ $dataitem->emps->user_name }}</td> <td>{{ date('d/m/y', strtotime($dataitem->date)) }}</td> <td>{{ $dataitem->time }}</td> @foreach($dataitem->measurements $measurement) <td>{{ $pools[$measurement->pivot->pool_id] }}</td> @endforeach <td>{{ html::linkroute('edit_data', 'rediger', $dataitem->id) }}</td> <td>{{ html::linkroute('delete_confirm', 'slett', $dataitem->id) }} </td> </tr> @endforeach </table> {{ $data->appends(array($type => 1, input::except('page')))->links() }} @elseif($type === 'task') </tr> @foreach($data $dataitem) <tr> <td>{{ $dataitem->id }}</td> <td>{{ $dataitem->tasks[0]->title }}</td> <td>{{ $dataitem->value }}</td> <td>{{ $dataitem->emps->user_name }}</td> <td>{{ date('d/m/y', strtotime($dataitem->date)) }}</td> <td>{{ $dataitem->time }}</td> <td>{{ html::linkroute('edit_data', 'rediger', $dataitem->id) }}</td> <td>{{ html::linkroute('delete_confirm', 'slett', $dataitem->id) }}</td> </tr> @endforeach @endif @endif @stop
thanks.
you nested array withing appends method:
$data->appends(array($type => 1, input::except('page')))->links() // returns array( $type => 1, array( ... // input/request params ignored nested array ) )
change to:
$data->appends(array_merge(array($type => 1), input::except('page')))->links()
Comments
Post a Comment