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