I am trying to do search with pagination but I am stuck with this GET error.
function search_document(Request $request){
$result = Document::where("title","like", "%".$request->input('query')."%")->paginate(5);
return view('/admin/documents')->with(["documents"=>$result]);
}
Error I got
- URL changed to /api/search_document that has to be like /admin/documents
- I am getting this Error
Route is like this :
Route::post("search_document",[adminDocumentController::class, 'search_document']);
Blade File Code
<form action="/api/search_document" class="main__title-form" method="POST">
<input type="text" placeholder="Find document" name="query">
<button type="submit">
<i class="icon ion-ios-search"></i>
</button>
</form>
Please help me
Route::post…
toRoute::get…
– staform
code with your question – stamethod="POST"
tomethod="GET"
and also from route. By default laravel pagination uses the get parameter – sta