/** * Prepare global variables. * @return array */ public static function globalData() { if (!Auth::check()) { $rows = null; $cart = null; $grandTotal = null; } else { $rows = Cart::instance(auth()->id())->count(false); $cart = Cart::instance(auth()->id())->content(); $grandTotal = Cart::instance(auth()->id())->total(); } $data = array('menu' => self::getMenuData(self::$parent_id), 'header' => Setting::findOrFail(1), 'rows' => $rows, 'cart' => $cart, 'grand_total' => $grandTotal, 'currencies' => Currency::all()); return $data; }