I'm trying to use the Auth :: attempt method to log in to my api, but it always falls on the else, even though it has the correspondence of that email / password in the database. Where can I configure this method Auth :: atempt? I think he should get the default parameter of laravel which is email / password, and how I switched to email / password does he not find?
My role:
function login(Request $request){
if (Auth::attempt(['email' => $request->email, 'senha' => $request->senha])){
return 'Autenticado com sucesso';
}else{
return response()->json([
'error' => 'Nome de usuário ou senha incorretos',
'code' => 401,], 401);
}
}
It always falls into the else ..
In my registry function, Hash :: make is used, does this impact Auth :: atempt in any way?
return User::create([
'nome' => $data['nome'],
'email' => $data['email'],
'telefone' => $data['telefone'],
'usuario_anjo' => $data['usuario_anjo'],
'senha' => Hash::make($data['senha']),
]);
@Edit:
I made a test by changing the hash :: make by bcrypty but still falls into the else ...