When i fill my search and post it, it gets the data and returns it. In this query i use ->paginate(50);
$products = Product7Days::where('omschrijving', 'LIKE', '%'.$request->omschrijving.'%')
->where('artikelnummer', 'LIKE', '%'.$request->artikelnummer.'%')
->whereIn('relatienummer', $leverancierenArray)
->whereIn('omzetgroep', $omzetgroepenArray)
->whereIn('btwcode', $BTWArray)
->whereBetween('prijs', [$prijsVan, $prijsTot])
->where('totaalaantal', '>=', $aantalVan)
->where('totaalaantal', '<=', $aantalTot)
->paginate(50);
My routes
Route::get('/artikelen', 'ProductController@index')->name('artikelen');
Route::post('/artikelen', 'ProductController@search')->name('artikelen.search');
So that all works, but when i go to the second page, for some reason no result is there
when i search, it goes to this page http://172.16.0.51:8000/artikelen
and when i click on page 2 the link is http://172.16.0.51:8000/artikelen?page=2 But no data
Blade file
@if (isset($products))
<table class="table table-striped table-responsive-xl">
<thead class="thead-dark">
<tr>
<th>Artikelnummer</th>
<th>Omschrijving</th>
<th>Prijs</th>
<th>Totaal <br> verkocht</th>
<th>Totaal <br> omzet</th>
@foreach ($filialen as $filiaal)
@if ($filiaal !== 6)
<th>aantal. <br>F{{$filiaal}}</th>
<th>voorr. <br>F{{$filiaal}}</th>
@else
<th>voorr. <br>F{{$filiaal}}</th>
@endif
@endforeach
</tr>
</thead>
<tbody>
@foreach ($products as $product)
<tr>
<th>{{ $product->artikelnummer}}</th>
<th>{{ $product->omschrijving}}</th>
<th>{{ $product->prijs}}</th>
<th>{{ $product->totaalaantal}}</th>
<th class="text-right">{{ round($product->totaalaantal * $product->prijs, 1) }}</th>
@foreach ($filialen as $filiaal)
@if ($filiaal !== 6)
<th class="text-right">{{ $product["aantalF".$filiaal] }}</th>
<th class="text-right">{{ $product["voorraadF".$filiaal] }}</th>
@else
<th>{{ $product->voorraadF6 }}</th>
@endif
@endforeach
</tr>
@endforeach
</tbody>
</table>
{{ $products->links() }}
@endif
The isset() returns false...
I am pretty sure when i click page 2 the data is getting lost but then would my question be how to i give that data through
articleen
route without using GET parameters? Something like?omschrijving=xxx&artikelnummer=xxx
– Wahyu Kristianto