I'm hacking this Laravel query, it returns this pagination fine for page 1, but the rest of the links go to blank filtered-search pages which should be more or the rest of the query results.
Controller:
<?php
namespace App\Http\Controllers;
use Illuminate\Support\Facades\DB;
use App\Http\Controllers\Controller;
use App\Job;
use Carbon\Carbon;
class FilterJobsController extends Controller
{
/**
* Show a list of all of the application's users.
*
* @return Response
*/
public function index()
{
$bidded = request('bidded');
$state = request('state');
$city = request('city');
$contractor = request('contractor');
$job = request('job');
$subjob = request('subjob');
$jobs = DB::table('jobs')->where([
['bidded', '=', $bidded],
['state', '=', $state],
['city', '=', $city],
['contractor', '=', $contractor],
['job', '=', $job],
['subjob', '=', $subjob],
])->paginate(3);
//])->get(); <<<former working method
return view('jobs.index', compact('jobs')->with('links', $links));
}
}
?>
Blade file:
@extends ('layouts.master')
@section ('content')
<div class="jobs">
@foreach(array_chunk($jobs->getCollection()->all(), 3) as $page)
<div class="leftarrow">❰</div>
@foreach ($jobs as $job)
@include ('jobs.job')
@endforeach
<div class="pagenumbers">
{{ $jobs->links() }}
</div>
<div class="rightarrow">
<!-- <a href="{{ url('/jobs/') }}"> -->
❱
<!-- </a> -->
</div>
<div class="downarrowrow">
<div class="downarrow">❱❱</div>
</div>
@endforeach
</div>
@endsection
As stated, the pagination page 1 work but the links in the paginated list go to a blank page, just layout-blade, header and footer info, no furthered search returns.
Any hints as to why the "links" has no information, just a valid link, would be appreciated.