I've been trying to authenticate for some time and I can not, I'm a beginner in the business, who wants to help me know that it's practically saving my life, since I've thought about giving up on it several times.
I'm calling a controller method via the login form ./
View:
{{Form::open(array('action' => 'UsuarioController@Login', 'method' => 'POST'))}}
In the controller I am setting a variable and searching the database if the login is entered according to the table login field, then I check if the login and password returns true to redirect the desired view, otherwise the login view returns . /
Controller:
class UsuarioController extends Controller
{
public function Login(Request $request)
{
$usuario = UsuarioEsic::where('login','=',$request->get('login'))->first();
if ($usuario && $usuario->senha) {
Auth::login($usuario);
return view('e_sic.usuario.esic_content');
} else {
return view('e_sic.inicio.esic_conteudo');
}
}
}
Model:
class UsuarioEsic extends Model
{
protected $table = 'usuario_esic';
public $timestamps = false;
public static $snakeAttributes = false;
protected $dates = ['dataNasc'];
}
Note: I did not really understand the route of the routes using auth, I thought I was doing the right thing according to the tutorials I saw.
Route:
Route::group(['middleware' => 'auth'], function(){
Route::auth();
Route::post('/Login', 'UsuarioController@Login');
});
Auth.php:
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => Portal\Entity\Local\UsuarioEsic::class,
],
AuthController:
protected $redirectTo = 'Esic/Conteudo';
Every time I try to log in it says that the page was not found and redirects me to the url I have or did not type anything in the login form.
I have already researched several topics in various forums, I have already seen videos and read tutorials about it and I still can not make progress on it, I know how difficult it is to learn things, but here I am asking you to ask someone with a good heart to lose a little of your time teaching me / explaining how I make it work perfectly, please! Thank you in advance.
Note: Any questions about the code I'm willing to pass on any information!