From a36626843dcfc6e81cb20c1cbbb93fb4147fbda2 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 7 Mar 2016 17:26:57 +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 027f512a47df..d0b17df7f021 100644 --- a/app/Libraries/Utils.php +++ b/app/Libraries/Utils.php @@ -274,7 +274,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; });