1 | <?php |
||||||
2 | |||||||
3 | namespace JosephNC\Translation\Middleware; |
||||||
4 | |||||||
5 | use Closure; |
||||||
6 | use Illuminate\Http\Request; |
||||||
7 | use JosephNC\Translation\Facades\Translation; |
||||||
8 | |||||||
9 | class LocaleMiddleware |
||||||
10 | { |
||||||
11 | /** |
||||||
12 | * Sets the locale cookie on every request depending |
||||||
13 | * on the locale supplied in the route prefix. |
||||||
14 | * |
||||||
15 | * @param Request $request |
||||||
16 | * @param Closure $next |
||||||
17 | * |
||||||
18 | * @return mixed |
||||||
19 | */ |
||||||
20 | public function handle(Request $request, Closure $next) |
||||||
21 | { |
||||||
22 | $lang = Translation::getRoutePrefix() ?? ''; |
||||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||||
23 | $lang = empty( $lang ) ? Translation::getLocale() : $lang; |
||||||
0 ignored issues
–
show
The method
getLocale() does not exist on JosephNC\Translation\Facades\Translation . Since you implemented __callStatic , consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
24 | |||||||
25 | Translation::setLocale( $lang ); |
||||||
0 ignored issues
–
show
The method
setLocale() does not exist on JosephNC\Translation\Facades\Translation . Since you implemented __callStatic , consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
26 | |||||||
27 | return $next($request); |
||||||
28 | } |
||||||
29 | } |
||||||
30 |