Remove AfterSessionBooted middleware

This commit is contained in:
Pig Fang 2019-04-06 23:22:36 +08:00
parent 23a9f018ca
commit 09b9959bc8
3 changed files with 1 additions and 37 deletions

View File

@ -30,7 +30,6 @@ class Kernel extends HttpKernel
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\AfterSessionBooted::class,
\App\Http\Middleware\DetectLanguagePrefer::class,
],

View File

@ -1,33 +0,0 @@
<?php
namespace App\Http\Middleware;
use Closure;
class AfterSessionBooted
{
/**
* Jobs should be done after session booted.
*
* @var array
*/
public static $jobs;
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
foreach (static::$jobs as $job) {
if (is_callable($job)) {
app()->call($job);
}
}
return $next($request);
}
}

View File

@ -29,8 +29,6 @@ class DetectLanguagePrefer
}
app()->setLocale($locale);
AfterSessionBooted::$jobs[] = function () {
session(['locale' => config('app.locale')]);
};
session(['locale' => config('app.locale')]);
}
}