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

41 lines
929 B
PHP

<?php
/*
* This file is part of the PHPFlasher package.
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
*/
namespace Flasher\Laravel\Middleware;
use Flasher\Laravel\Http\Request;
use Flasher\Laravel\Http\Response;
use Flasher\Prime\Http\RequestExtension;
use Illuminate\Http\Request as LaravelRequest;
use Illuminate\Http\Response as LaravelResponse;
final class SessionMiddleware
{
/**
* @var RequestExtension
*/
private $requestExtension;
public function __construct(RequestExtension $requestExtension)
{
$this->requestExtension = $requestExtension;
}
/**
* @return LaravelResponse
*/
public function handle(LaravelRequest $request, \Closure $next)
{
/** @var LaravelResponse $response */
$response = $next($request);
$this->requestExtension->flash(new Request($request), new Response($response));
return $response;
}
}