Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
66.67% |
2 / 3 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
Localization | |
66.67% |
2 / 3 |
|
0.00% |
0 / 1 |
2.15 | |
0.00% |
0 / 1 |
handle | |
66.67% |
2 / 3 |
|
0.00% |
0 / 1 |
2.15 |
1 | <?php |
2 | namespace App\Http\Middleware; |
3 | use Closure; |
4 | use Illuminate\Http\Request; |
5 | use Illuminate\Support\Facades\App; |
6 | use Illuminate\Support\Facades\Session; |
7 | class Localization |
8 | { |
9 | /** |
10 | * Handle an incoming request. |
11 | * |
12 | * @param \Illuminate\Http\Request $request |
13 | * @param \Closure $next |
14 | * @return mixed |
15 | */ |
16 | public function handle(Request $request, Closure $next): mixed |
17 | { |
18 | if (Session::has('locale')) { |
19 | App::setLocale(Session::get('locale')); |
20 | } |
21 | return $next($request); |
22 | } |
23 | } |