Update NotificationService

This commit is contained in:
Daniel Supernault 2019-05-20 21:32:35 -06:00
parent 251723ccc0
commit 519c05de32
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
1 changed files with 10 additions and 0 deletions

View File

@ -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)