This package will save login and logout activity of user
Considering user_id
as your primary column
of users
table follow below steps to install this package -, (*1)
Install the package by running below command in your terminal -, (*2)
composer require mahfuz/login-activity:dev-master
, (*3)
Add below Service Provider in your providers
array of config/app.php
file, (*4)
Mahfuz\LoginActivity\LoginActivityServiceProvider::class,
, (*5)
Run php artisan migrate
in your terminal. This will run a migration file required to make this project work which will create a table name login_activities
in your database., (*6)
Add below event listeners to $listen
array of app/Providers/EventServiceProvider.php
, (*7)
```$xslt 'Illuminate\Auth\Events\Login' => [ 'Mahfuz\LoginActivity\Listeners\LogSuccessfulLogin', ],, (*8)
'Illuminate\Auth\Events\Failed' => [ 'Mahfuz\LoginActivity\Listeners\LogFailedLogin', ],, (*9)
'Illuminate\Auth\Events\Logout' => [ 'Mahfuz\LoginActivity\Listeners\LogSuccessfulLogout', ], ```, (*10)
To view login activities visit this URL http://localhost:8000/login-activity
., (*11)
*** Please note that url('login-activity')
is protected by auth
middleware. So, only logged in user can able to browse this route path., (*12)
Go to your project root via terminal and run php artisan vendor:publish
, (*13)
Once done check config/login-activity.php
, you can configure it to whether send email upon 'X' failed login attempts in last 'N' minutes or not., (*14)
Also check resources/views/vendor/login-activity
if you want to update login activity view and failed login attempt email view., (*15)
That's all., (*16)
, (*17)