public function run(Request $request, Response $response) { if (!($user = Auth::instance()->logged_in())) { // This is an example middleware for the authentication class // Return to login page or something } else { Auth::$user = $user; } // Keep in mind that middlewares need to return an instance of Middleware ($this) return $this; }