Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
changeLangMiddleware
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 1
 handle
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3namespace App\Http\Middleware\api;
4
5use Closure;
6use Illuminate\Http\Request;
7use Illuminate\Support\Facades\App;
8
9class changeLangMiddleware
10{
11    /**
12     * Handle an incoming request.
13     *
14     * @param  \Illuminate\Http\Request  $request
15     * @param  \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse)  $next
16     * @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
17     */
18    public function handle(Request $request, Closure $next)
19    {
20        ($request->header('lang') == 'ar')? App::setLocale('ar'): App::setLocale('en');
21
22        return $next($request);
23    }
24}