Laravel Authentication 5.4

Asked

Viewed 1,298 times

2

Talk guys, so, recently I started studying Laravel through some books/ video lessons, and I’m nodding my head with something related to authentication.

When I take command php artisan make:auth The Laravel returns to me

The Routes

Auth::routes();

The Controllers

inserir a descrição da imagem aqui

And the Views

So far so good, but running the remote php artisan route:list it indicates for example that the route accessed to log in is located at App\Http\Controllers\Auth\LoginController@login, but as you can see in the next image there is no such method login in that class LoginController.

inserir a descrição da imagem aqui

Someone who knows the subject can explain to me how Laravel’s authentication works?

PS: I couldn’t put all the images, I put the main ones then.

1 answer

4


Okay, come on... you see that PHP is using an Authenticatesusers trait, this trait is the page you are looking for where you have the login method and also the logout.

In Logincontroller, see this line:

use AuthenticatesUsers; 

That uses that namespace(path):

use Illuminate\Foundation\Auth\AuthenticatesUsers;

Now, let’s go to the folder: vendor/Laravel/src/Illuminate/Foundation/Auth/Authenticatesusers.php

inserir a descrição da imagem aqui

See? The methods are all there, it’s in the vendor folder (where you have the Framework itself with all its classes. In the Auth folder you can see all the code and learn more about the behavior of the authentication class. I suggest you read some authentication and watch some videos on laracasts.

  • Thanks Ivo, now I could understand how this authentication works more or less, to tell you the truth, I didn’t know very well what this Illuminate was, but now I know where to find it and see how it works.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.