for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Cortex\Auth\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
class UpdateLastActivity
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle(Request $request, Closure $next)
return $next($request);
}
* Perform any final actions for the request lifecycle.
* @param \Symfony\Component\HttpFoundation\Response $response
* @return void
public function terminate($request, $response): void
$response
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
if ($user = $request->user(request()->route('guard'))) {
// We are using database queries rather than eloquent, to bypass triggering events.
// Triggering update events flush cache and costs us more queries, which we don't need.
$user->newQuery()->where($user->getKeyName(), $user->getKey())->update(['last_activity' => now()]);
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.