Level 37
You can use the Paginator class. Something like this:
$slicedCrashes = array_slice($crashes, (request('page') ? request('page') - 1 : 0) * $perPage, $perPage);
return new LengthAwarePaginator(
$slicedCrashes,
count($crashes),
$perPage,
request('page'),
['path' => url()->current()]
);
LengthAwarePaginator accepts the result subset (slicedCrashes), the total count, the amount of results per page, the current page, and an array of options. In the options array you only have to make sure that the url is correct, in order to build the links correctly.
Then you can use the results as a normal paged Eloquent model.