supplier = $supplier; $this->contract = $contract; } /** * Returns count of supplier. * * @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.supplier.gadget', $count = 10) { if (User::hasRole('user')) { $this->supplier->pushCriteria(new \Litepie\Islhd\Repositories\Criteria\SupplierUserCriteria()); } $supplier = $this->supplier->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('supplier::' . $view, compact('supplier'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.contract.gadget', $count = 10) { if (User::hasRole('user')) { $this->contract->pushCriteria(new \Litepie\Islhd\Repositories\Criteria\ContractUserCriteria()); } $contract = $this->contract->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('supplier::' . $view, compact('contract'))->render(); } }