| Conditions | 4 |
| Paths | 4 |
| Total Lines | 23 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 5 | ||
| Bugs | 1 | Features | 2 |
| 1 | <?php |
||
| 11 | public static function listen(QueryExecuted $query) |
||
| 12 | { |
||
| 13 | if (config('laravel-query-adviser.enable_query_logging') === false) { |
||
| 14 | return; |
||
| 15 | } |
||
| 16 | |||
| 17 | $sessionKey = self::getSessionKey(); |
||
| 18 | |||
| 19 | if (empty($sessionKey)) { |
||
| 20 | return; |
||
| 21 | } |
||
| 22 | |||
| 23 | $url = url()->current(); |
||
| 24 | if (str_contains($url, '/query-adviser')) { |
||
| 25 | return; |
||
| 26 | } |
||
| 27 | |||
| 28 | $time = time(); |
||
| 29 | $data = self::getFromCache($time, $sessionKey); |
||
| 30 | |||
| 31 | self::putToCache( |
||
| 32 | (new SessionFormatter())->format($time, $data, $query), |
||
| 33 | $sessionKey |
||
| 34 | ); |
||
| 81 |