StocksNew/vendor/php-flasher/flasher-laravel/Middleware/HttpKernelFlasherMiddleware.php
Sampanna Rimal 53c0140f58 first commit
2024-08-27 17:48:06 +05:45

41 lines
1.1 KiB
PHP

<?php
/*
* This file is part of the PHPFlasher package.
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
*/
namespace Flasher\Laravel\Middleware;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
use Symfony\Component\HttpKernel\HttpKernelInterface;
final class HttpKernelFlasherMiddleware implements HttpKernelInterface
{
/**
* @var \Symfony\Component\HttpKernel\HttpKernelInterface
*/
private $app;
public function __construct(HttpKernelInterface $app)
{
$this->app = $app;
}
public function handle(SymfonyRequest $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
{
$response = $this->app->handle($request, $type, $catch);
$request = Request::createFromBase($request);
$next = function () use ($response) {
return $response;
};
/** @var SessionMiddleware $sessionMiddleware */
$sessionMiddleware = $this->app->make('Flasher\Laravel\Middleware\FlasherMiddleware');
return $sessionMiddleware->handle($request, $next);
}
}