provider = $provider; $this->booking = $booking; $this->quote = $quote; $this->comment = $comment; $this->subscription = $subscription; $this->provider_availability = $provider_availability; $this->review = $review; } /** * Returns count of service. * * @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.provider.gadget', $count = 10) { if (User::hasRole('user')) { $this->provider->pushCriteria(new \Litepie\B2buy\Repositories\Criteria\ProviderUserCriteria()); } $provider = $this->provider->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('service::' . $view, compact('provider'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.booking.gadget', $count = 10) { if (User::hasRole('user')) { $this->booking->pushCriteria(new \Litepie\B2buy\Repositories\Criteria\BookingUserCriteria()); } $booking = $this->booking->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('service::' . $view, compact('booking'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.quote.gadget', $count = 10) { if (User::hasRole('user')) { $this->quote->pushCriteria(new \Litepie\B2buy\Repositories\Criteria\QuoteUserCriteria()); } $quote = $this->quote->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('service::' . $view, compact('quote'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.comment.gadget', $count = 10) { if (User::hasRole('user')) { $this->comment->pushCriteria(new \Litepie\B2buy\Repositories\Criteria\CommentUserCriteria()); } $comment = $this->comment->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('service::' . $view, compact('comment'))->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\B2buy\Repositories\Criteria\SubscriptionUserCriteria()); } $subscription = $this->subscription->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('service::' . $view, compact('subscription'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.provider_availability.gadget', $count = 10) { if (User::hasRole('user')) { $this->provider_availability->pushCriteria(new \Litepie\B2buy\Repositories\Criteria\ProviderAvailabilityUserCriteria()); } $provider_availability = $this->provider_availability->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('service::' . $view, compact('provider_availability'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.review.gadget', $count = 10) { if (User::hasRole('user')) { $this->review->pushCriteria(new \Litepie\B2buy\Repositories\Criteria\ReviewUserCriteria()); } $review = $this->review->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('service::' . $view, compact('review'))->render(); } }