ship = $ship; $this->hotel = $hotel; $this->club = $club; } /** * Returns count of object. * * @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.ship.gadget', $count = 10) { if (User::hasRole('user')) { $this->ship->pushCriteria(new \Litepie\Btravel\Repositories\Criteria\ShipUserCriteria()); } $ship = $this->ship->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('object::' . $view, compact('ship'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.hotel.gadget', $count = 10) { if (User::hasRole('user')) { $this->hotel->pushCriteria(new \Litepie\Btravel\Repositories\Criteria\HotelUserCriteria()); } $hotel = $this->hotel->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('object::' . $view, compact('hotel'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.club.gadget', $count = 10) { if (User::hasRole('user')) { $this->club->pushCriteria(new \Litepie\Btravel\Repositories\Criteria\ClubUserCriteria()); } $club = $this->club->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('object::' . $view, compact('club'))->render(); } }