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