Update all the middlewares
This commit is contained in:
parent
e0d03513e4
commit
79decafdc8
16 changed files with 161 additions and 100 deletions
|
@ -9,14 +9,28 @@
|
|||
|
||||
namespace Pterodactyl\Http\Middleware;
|
||||
|
||||
use Auth;
|
||||
use Closure;
|
||||
use Session;
|
||||
use Settings;
|
||||
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.
|
||||
*
|
||||
|
@ -24,17 +38,9 @@ class LanguageMiddleware
|
|||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
// if (Session::has('applocale')) {
|
||||
// App::setLocale(Session::get('applocale'));
|
||||
// } elseif (Auth::check() && isset(Auth::user()->language)) {
|
||||
// Session::put('applocale', Auth::user()->language);
|
||||
// App::setLocale(Auth::user()->language);
|
||||
// } else {
|
||||
// App::setLocale(Settings::get('default_language', 'en'));
|
||||
// }
|
||||
App::setLocale('en');
|
||||
App::setLocale($this->config->get('app.locale', 'en'));
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue