Conditions | 5 |
Paths | 4 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | public function handle($request, Closure $next) |
||
17 | { |
||
18 | $redirect = app('redirect.model')->findValidOrNull($request->path()); |
||
19 | |||
20 | if (! $redirect && $request->getQueryString()) { |
||
21 | $path = $request->path().'?'.$request->getQueryString(); |
||
22 | $redirect = app('redirect.model')->findValidOrNull($path); |
||
23 | } |
||
24 | |||
25 | if ($redirect && $redirect->exists) { |
||
26 | return redirect($redirect->new_url, $redirect->status); |
||
27 | } |
||
28 | |||
29 | return $next($request); |
||
30 | } |
||
31 | } |
||
32 |