media = $media; $this->brand = $brand; $this->media_tag = $media_tag; $this->media_topic = $media_topic; $this->target_group = $target_group; $this->media_detail = $media_detail; $this->media_detail_category = $media_detail_category; } /** * 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.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.brand.gadget', $count = 10) { if (User::hasRole('user')) { $this->brand->pushCriteria(new \Litepie\Litepie\Repositories\Criteria\BrandUserCriteria()); } $brand = $this->brand->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('medium::' . $view, compact('brand'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.media_tag.gadget', $count = 10) { if (User::hasRole('user')) { $this->media_tag->pushCriteria(new \Litepie\Litepie\Repositories\Criteria\MediaTagUserCriteria()); } $media_tag = $this->media_tag->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('medium::' . $view, compact('media_tag'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.media_topic.gadget', $count = 10) { if (User::hasRole('user')) { $this->media_topic->pushCriteria(new \Litepie\Litepie\Repositories\Criteria\MediaTopicUserCriteria()); } $media_topic = $this->media_topic->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('medium::' . $view, compact('media_topic'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.target_group.gadget', $count = 10) { if (User::hasRole('user')) { $this->target_group->pushCriteria(new \Litepie\Litepie\Repositories\Criteria\TargetGroupUserCriteria()); } $target_group = $this->target_group->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('medium::' . $view, compact('target_group'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.media_detail.gadget', $count = 10) { if (User::hasRole('user')) { $this->media_detail->pushCriteria(new \Litepie\Litepie\Repositories\Criteria\MediaDetailUserCriteria()); } $media_detail = $this->media_detail->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('medium::' . $view, compact('media_detail'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.media_detail_category.gadget', $count = 10) { if (User::hasRole('user')) { $this->media_detail_category->pushCriteria(new \Litepie\Litepie\Repositories\Criteria\MediaDetailCategoryUserCriteria()); } $media_detail_category = $this->media_detail_category->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('medium::' . $view, compact('media_detail_category'))->render(); } }