| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 13 | public function findByToken(string $token): ?Notification |
||
| 14 | { |
||
| 15 | $notificationId = Cache::get("notifier:tracking_token:{$token}"); |
||
| 16 | |||
| 17 | if ($notificationId) { |
||
| 18 | return Notification::find($notificationId); |
||
|
|
|||
| 19 | } |
||
| 20 | |||
| 21 | $notifications = Notification::whereJsonContains('data->tracking_token', $token)->get(); |
||
| 22 | |||
| 23 | if ($notifications->count() > 0) { |
||
| 24 | $notification = $notifications->first(); |
||
| 25 | Cache::put("notifier:tracking_token:{$token}", $notification->id, now()->addDays(30)); |
||
| 26 | return $notification; |
||
| 27 | } |
||
| 28 | |||
| 29 | return null; |
||
| 30 | } |
||
| 32 |