2016-11-13 15:05:24 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
|
|
|
|
use Closure;
|
|
|
|
use Illuminate\Http\Request;
|
2019-07-22 07:03:23 +00:00
|
|
|
use Illuminate\Support\Arr;
|
2016-11-13 15:05:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if the app is running in an E2E session and use the proper data settings.
|
|
|
|
*/
|
|
|
|
class UseDifferentConfigIfE2E
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function handle(Request $request, Closure $next)
|
|
|
|
{
|
2019-07-22 07:03:23 +00:00
|
|
|
if (Arr::get($_SERVER, 'SERVER_PORT') === '8081') {
|
2016-11-13 15:05:24 +00:00
|
|
|
config(['database.default' => 'sqlite-e2e']);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $next($request);
|
|
|
|
}
|
|
|
|
}
|