misc_pterodactyl-panel/app/Http/Middleware/Api/SetSessionDriver.php

36 lines
707 B
PHP
Raw Permalink Normal View History

2017-11-19 20:05:13 +00:00
<?php
namespace Pterodactyl\Http\Middleware\Api;
2017-11-19 20:05:13 +00:00
use Closure;
use Illuminate\Http\Request;
use Illuminate\Contracts\Config\Repository as ConfigRepository;
class SetSessionDriver
{
/**
* @var \Illuminate\Contracts\Config\Repository
*/
private $config;
/**
* SetSessionDriver constructor.
*/
2018-07-05 02:38:23 +00:00
public function __construct(ConfigRepository $config)
2017-11-19 20:05:13 +00:00
{
$this->config = $config;
}
/**
* Set the session for API calls to only last for the one request.
*
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
$this->config->set('session.driver', 'array');
return $next($request);
}
}