I'm facing some trouble at pagination on laravel. Already paginate the table. But in view page the numbers are not okay.This is how it's look like:
https://i.stack.imgur.com/407Oo.png
The other problem is when I press the numbers, links are dead and giving me this error:
Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException No message
This my route:
Route::get("/", "PagesController@welcome");
Route::post("/search", "PagesController@search")->name('search.route');
And this my view:
public function search(Request $request)
{
$q = $request->q;
if ($q !== null && trim($q) !== ""){//here
$estates = \DB::table('allestates')
->where("building_name","LIKE", "%" . $q . "%")
->orWhere("address","LIKE", "%" . $q . "%")
->orWhere("company_name","LIKE", "%" . $q . "%")
->orWhere("region","LIKE", "%" . $q . "%")
->orderBy('price')->paginate(10);
if(count($estates) > 0){
return view("search", compact('estates'))->withQuery($q);
}
}
$estates = array();//here
return view("search", compact('estates'))->withMessage("No Found!");//here
}
The other thing is in controller I can't add ->paginate(10)
with ->get()
it's returning as a error like:
Method Illuminate\Support\Collection::paginate does not exist.
I really appreciate any help to solve this problems. Thank you! By the way if connected or not I don't know, but I already deleted/changed "boostrap" file in public.