-
app/Http/Middleware/LogLastUserActivity.php
Open in GitHubuse Closure; use Cache; use Carbon; class LogLastUserActivity { public function handle($request, Closure $next) { if (\Auth::check()) { $expiresAt = Carbon::now()->addMinutes(5); Cache::put('user-is-online-' . \Auth::user()->id, true, $expiresAt); } return $next($request); } }