Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
66.67% covered (warning)
66.67%
2 / 3
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
Localization
66.67% covered (warning)
66.67%
2 / 3
0.00% covered (danger)
0.00%
0 / 1
2.15
0.00% covered (danger)
0.00%
0 / 1
 handle
66.67% covered (warning)
66.67%
2 / 3
0.00% covered (danger)
0.00%
0 / 1
2.15
1<?php
2namespace App\Http\Middleware;
3use Closure;
4use Illuminate\Http\Request;
5use Illuminate\Support\Facades\App;
6use Illuminate\Support\Facades\Session;
7class 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}