<?php
function search(Request $request, $type, $color) {
$page = $request->input('page') ?: 1;
$path = public_path(). "/images/posts/" . $color . "/" . "SIMPLE-NOTEXT/" . $type . "/LEFT/";
$files = collect(File::files($path));
$onPage = 15;
$slice = $files->slice(($page-1)* $onPage, $onPage);
$paginator = new \Illuminate\Pagination\LengthAwarePaginator($slice, $files->count(), $onPage);
return view('search.searching', [
'files' => $paginator,
'total' => $files,
'page_unit' => ceil(count($files) / $onPage),
'currentPage' => \Request::get('page'),
'params' => [
"type" => $type,
"color" => $color
],
]);
}
?>