From 52d25192af80f349777594ddaddce95d7c097073 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 7 Mar 2016 17:22:20 +0200 Subject: [PATCH] Added warning if cache isn't set --- app/Libraries/Utils.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/Libraries/Utils.php b/app/Libraries/Utils.php index fbe1cb6a1c52..fcb210b0d7ad 100644 --- a/app/Libraries/Utils.php +++ b/app/Libraries/Utils.php @@ -281,7 +281,14 @@ class Utils } public static function getFromCache($id, $type) { - $data = Cache::get($type)->filter(function($item) use ($id) { + $cache = Cache::get($type); + + if ( ! $cache) { + static::logError("Cache for {$type} is not set"); + return null; + } + + $data = $cache->filter(function($item) use ($id) { return $item->id == $id; });