2017-11-19 20:05:13 +00:00
|
|
|
<?php
|
|
|
|
|
2018-02-25 21:30:56 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|