distributionarea = $distributionarea; $this->targetgroup = $targetgroup; $this->linkinfo = $linkinfo; $this->status = $status; $this->mediatype = $mediatype; } /** * Returns count of master. * * @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.distributionarea.gadget', $count = 10) { if (User::hasRole('user')) { $this->distributionarea->pushCriteria(new \Litepie\Litepie\Repositories\Criteria\DistributionareaUserCriteria()); } $distributionarea = $this->distributionarea->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('master::' . $view, compact('distributionarea'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.targetgroup.gadget', $count = 10) { if (User::hasRole('user')) { $this->targetgroup->pushCriteria(new \Litepie\Litepie\Repositories\Criteria\TargetgroupUserCriteria()); } $targetgroup = $this->targetgroup->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('master::' . $view, compact('targetgroup'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.linkinfo.gadget', $count = 10) { if (User::hasRole('user')) { $this->linkinfo->pushCriteria(new \Litepie\Litepie\Repositories\Criteria\LinkinfoUserCriteria()); } $linkinfo = $this->linkinfo->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('master::' . $view, compact('linkinfo'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.status.gadget', $count = 10) { if (User::hasRole('user')) { $this->status->pushCriteria(new \Litepie\Litepie\Repositories\Criteria\StatusUserCriteria()); } $status = $this->status->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('master::' . $view, compact('status'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.mediatype.gadget', $count = 10) { if (User::hasRole('user')) { $this->mediatype->pushCriteria(new \Litepie\Litepie\Repositories\Criteria\MediatypeUserCriteria()); } $mediatype = $this->mediatype->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('master::' . $view, compact('mediatype'))->render(); } }