So, we create the column and then put an update query after the authentication.
Ok, so why not create a new column in the user’s table and update that column when the user has successfully authenticated. Now, suddenly we need to log the last time the user logged in. $credentials = array('email' => $postData, 'password' => $postData) $this->layout->content = View::make('er_login') We use the default Auth::attempt function and check the email and password to authenticate the user. I used Laravel’s authentication class and build a simple login and everything is working fine.
So we are building an application where initially a user was able to log in. (But yes, if you already know that then you can actually skip this gyan and dive directly into the implementation part). Why we need events?īefore actually going into how to write events, it is important to know what is an event and how it is useful. In this tutorial, I will show you how to use a Laravel event like user login and perform some activity using a complete different class. Laravel's event is one such thing which I can compare with hooks. It’s a great way to separate the concerns of code which in long-term helps us write maintainable code.
We can modify core features of Drupal entities without hacking the core. One of the most powerful aspects of Drupal is the concept of hooks.