I have the following problems !
I recieve the information from the form
public function crearcomentario ()
{
$blogId = \Request::input('identificador');
$autor = \Request::input('autor');
$correo = \Request::input('correo');
$content = \Request::input('content');
$find = User::where('username','=',$autor)->get();
$buscar = $find->toArray();
$comentarios = new Comentario();
//$comentarios->autor_id = $buscar[0]["id"];
$comentarios->correo = $correo;
$comentarios->articulo_id = $blogId;
$comentarios->contenido = $content;
echo $find;
echo $autor;
//$comentarios->save();
}
The variable $find
return the information about user introduce in the form.
My question is how can I compare if the user find is empty [] ? I try to use
if(is_null($find))
but doesn't work.