. * * This software is licensed under the terms of the MIT license. * https://opensource.org/licenses/MIT */ namespace Pterodactyl\Http\Middleware; use Closure; use Illuminate\Http\Request; use Illuminate\Support\Facades\App; use Illuminate\Contracts\Config\Repository; class LanguageMiddleware { /** * @var \Illuminate\Contracts\Config\Repository */ private $config; /** * LanguageMiddleware constructor. * * @param \Illuminate\Contracts\Config\Repository $config */ public function __construct(Repository $config) { $this->config = $config; } /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle(Request $request, Closure $next) { App::setLocale($this->config->get('app.locale', 'en')); return $next($request); } }