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