Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from robinklaassen/feature/last-login
fix: last login date
- Loading branch information
Showing
5 changed files
with
31 additions
and
38 deletions.
There are no files selected for viewing
Empty file.
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace App\Listeners; | ||
|
||
use Illuminate\Auth\Events\Login as LoginEvent; | ||
|
||
class SetLastLoginDate | ||
{ | ||
/** | ||
* Handle the event, sets the user's last_login to current dateTime | ||
* | ||
* @param object $event | ||
* @return void | ||
*/ | ||
public function handle(LoginEvent $event) | ||
{ | ||
$user = $event->user; | ||
$user->last_login = new \DateTime; | ||
$user->save(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters