Here is my blade file code
<div class="search-area">
<form action="{{ route('search.product') }}" method="GET">
<div class="control-group">
<input class="search-field" name="search" />
<button class="search-button" type="submit"></button>
</div>
</form>
</div>
My web.php code is:
Route::get('/search-products',[SearchController::class,'searchProduct'])->name('search.product');
My Controller code is:
public function searchProduct(Request $request){
return $search = $request->search;
}
I can access Request data from Controller when I use POST method.
Please help me to find the soluation. Thanks in advance.
You should send back your search aria data like:
oute::get('/search-products/{name}',[SearchController::class,'searchProduct'])->name('search.product');
you can use this method to send data for your blade:
$data = YOUR_MODEL::findOrFail($id);
return view('YOUR_VIEW_BLADE', compact('data'));
then you can use
@foreach($data as $row)
<tr>
<td>{{ $row->first_name }}</td>
<td>{{ $row->last_name}}</td>
</tr>
@endforeach
Dont forget this is an example you need to modify with your app.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.