From 519c05de320128acbc4696c2ee0de9ab1c090bbd Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 20 May 2019 21:32:35 -0600 Subject: [PATCH] Update NotificationService --- app/Services/NotificationService.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/Services/NotificationService.php b/app/Services/NotificationService.php index 91b2d21c7..4827a6c6f 100644 --- a/app/Services/NotificationService.php +++ b/app/Services/NotificationService.php @@ -79,6 +79,16 @@ class NotificationService { $resource = new Fractal\Resource\Item($n, new NotificationTransformer()); return $fractal->createData($resource)->toArray(); }); + } + + public static function setNotification(Notification $notification) + { + return Cache::remember('service:notification:'.$notification->id, now()->addDays(7), function() use($notification) { + $fractal = new Fractal\Manager(); + $fractal->setSerializer(new ArraySerializer()); + $resource = new Fractal\Resource\Item($notification, new NotificationTransformer()); + return $fractal->createData($resource)->toArray(); + }); } public static function warmCache($id, $stop = 100, $force = false)