store = $store; $this->stock = $stock; } /** * Returns count of store. * * @param array $filter * * @return int */ public function count() { return 0; } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.store.gadget', $count = 10) { if (User::hasRole('user')) { $this->store->pushCriteria(new \Litepie\Islhd\Repositories\Criteria\StoreUserCriteria()); } $store = $this->store->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('store::' . $view, compact('store'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.stock.gadget', $count = 10) { if (User::hasRole('user')) { $this->stock->pushCriteria(new \Litepie\Islhd\Repositories\Criteria\StockUserCriteria()); } $stock = $this->stock->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('store::' . $view, compact('stock'))->render(); } }