| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 7 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 19 | public function handle(Request $request, Closure $next) |
||
| 20 | { |
||
| 21 | // Add unique ID to be used to relate traffic & activities |
||
| 22 | $request->attributes->add(['track_traffic_token' => uniqid()]); |
||
| 23 | |||
| 24 | // Create response |
||
| 25 | $response = $next($request); |
||
| 26 | |||
| 27 | // Check if traffic tracking is enabled |
||
| 28 | if (config('tracking.traffic.track')) { |
||
| 29 | |||
| 30 | // Fire Traffic Tracker event |
||
| 31 | event(new TrackTrafficEvent($request, $response, microtime(true))); |
||
| 32 | } |
||
| 33 | |||
| 34 | // Return the response |
||
| 35 | return $response; |
||
| 36 | } |
||
| 38 |