| Conditions | 3 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public static function get(string $key, string $default = null) |
||
| 27 | { |
||
| 28 | if (Cache::has($key)) { |
||
| 29 | return Cache::get($key); |
||
| 30 | } |
||
| 31 | |||
| 32 | $dbValue = self::where('key', $key)->first(); |
||
| 33 | $value = isset($dbValue) ? json_decode($dbValue->value) : $default; |
||
| 34 | Cache::forever($key, $value); |
||
| 35 | |||
| 36 | return $value; |
||
| 37 | } |
||
| 38 | |||
| 67 |