Ventas->Listado->Ventas
This commit is contained in:
25
app/src/Middleware/NotFound.php
Normal file
25
app/src/Middleware/NotFound.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace Incoviba\Middleware;
|
||||
|
||||
use Psr\Http\Message\ResponseFactoryInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Server\RequestHandlerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Slim\Exception\HttpNotFoundException;
|
||||
use Incoviba\Common\Alias\View;
|
||||
|
||||
class NotFound
|
||||
{
|
||||
public function __construct(protected LoggerInterface $logger, protected ResponseFactoryInterface $responseFactory, protected View $view) {}
|
||||
public function __invoke(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
|
||||
{
|
||||
try {
|
||||
return $handler->handle($request);
|
||||
} catch (HttpNotFoundException $exception) {
|
||||
$this->logger->warning($exception);
|
||||
$response = $this->responseFactory->createResponse(404);
|
||||
return $this->view->render($response, 'not_found');
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user