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