20 lines
383 B
PHP
20 lines
383 B
PHP
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use App\Core\Response;
|
|
use App\Services\AuthService;
|
|
|
|
class AuthMiddleware
|
|
{
|
|
public function handle(array $params, callable $next): Response
|
|
{
|
|
$auth = AuthService::getInstance();
|
|
if (!$auth->check()) {
|
|
return new Response('', 302, ['Location' => '/login']);
|
|
}
|
|
|
|
return $next($params);
|
|
}
|
|
}
|