I wanted to know if the query is well done Where to find the posts of a blog that contain a word "query":
public function search(Request $request)
{
//guarda la palabra en $query
$query = $request->input('query');
//consulta si "$query" se encuentra dentro del contenido de algun mensaje
$messages = Message::with('user')->where('content','LIKE',"%query%")->get();
//retorna la vista "welcome.blade.php" con los resultados
return view('welcome', [
'messages' => $messages,
]);
}
It does not return any post, but I have 2 with that word.