Created
January 27, 2018 03:06
-
-
Save georgewritescode/c2165f5eecd2e9932d9811c34370b4a8 to your computer and use it in GitHub Desktop.
database lastseen
This file contains hidden or 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
<?php | |
namespace App\Http\Middleware; | |
use Closure; | |
use Illuminate\Support\Facades\Auth; | |
use Illuminate\Support\Facades\Redis; | |
class LastSeen | |
{ | |
public function handle($request, Closure $next) | |
{ | |
if (!Auth::check()) { | |
return $next($request); | |
} | |
$user = Auth::user(); | |
$user->update([ | |
'last_seen' => new \DateTime(), | |
]); | |
return $next($request); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment