<?php namespace kernel\middlewares; use kernel\Middleware; class AuthMiddleware extends Middleware { function handler() { if(!isset($_COOKIE['user_id'])) { header('Location: /admin/login', true, 302); return false; } } }