Answer the question
In order to leave comments, you need to log in
Extracting information from a search?
Good evening,
Somehow I did a search on the site, which, in theory, should search for information from the database ...
But I don’t understand how to display information on the site ..
public function search(Request $request)
{
$name = $request->input('Name');
$item = DB::connection('555')->table('Shop_Goods')->where('name', 'LIKE', '%' . $name . '%')->get();
return view('adminka.test')->with($name, $item);
}
Route::get('search', 'Admin\[email protected]')->name('search');
Route::post('search1', 'Admin\[email protected]')->name('search1');
<form action="/search1" accept-charset="UTF-8" method="post">
{!! csrf_field() !!}
<input type="text" id="Name" name="Name" placeholder="Название предмета">
<input type="submit" value="Найти">
</form>
Answer the question
In order to leave comments, you need to log in
Look, now you have already written the output of the results to the admin/test.blade.php template in the controller
public function search(Request $request)
{
$name = $request->input('Name');
$item = DB::connection('555')->table('Shop_Goods')->where('name', 'LIKE', '%' . $name . '%')->get();
return view('adminka.test')->with($name, $item);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question