| Conditions | 3 |
| Paths | 3 |
| Total Lines | 19 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 3.7898 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | 41 | public function handle($request, Closure $next) |
|
| 19 | { |
||
| 20 | $crawlers = [ |
||
| 21 | 41 | 'facebookexternalhit/1.1', |
|
| 22 | 'facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)', |
||
| 23 | 'Facebot', |
||
| 24 | 'Twitterbot', |
||
| 25 | ]; |
||
| 26 | |||
| 27 | 41 | $userAgent = $request->header('User-Agent'); |
|
| 28 | |||
| 29 | 41 | if (str_contains($userAgent, $crawlers)) { |
|
|
|
|||
| 30 | switch (Route::getCurrentRoute()->getName()) { |
||
| 31 | case "register.category": |
||
| 32 | $tournament = Tournament::where('slug', $request->tournament)->first(); |
||
| 33 | return view('public/register', compact('tournament')); |
||
| 34 | } |
||
| 35 | } |
||
| 36 | 41 | return $next($request); |
|
| 37 | } |
||
| 39 |