1
I’m trying to take the content name of an input from my search page (Search), and send it to another view (Data), where the controller will receive this value and from there will search the database for information related to this name (Ex: id, name or gender)so it will fill in the inputs of the "Data" view, but I am not succeeding. Follow the code of my controller:
public function search(User $request)
{
$nome = $request->input('teste');
$users = DB::select('select * from users where nome = ?', $nome);*/
return view('users.index')->with('id', $users->id);
return view('users.index')->with('sexo', $users->sexo);
return view('users.index')->with('idade', $users->idade);
}
That is, what I am trying to do is that the View "data" receives information from the controller’s SQL query, related to the name that was put in the input of the search page.
This "User" is the controller, model or request?
– aguiar677
would be your model, but updated the question using
DB::select
to make it easier– user156109