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