public static function forShows($shows) { $slides = new Slides(); foreach ($shows as $key => $show) { $slide = Slide::fromScheduledShow($show); $slide->playOrder($key); $slide->index($key); $slides->push($slide); } return $slides; }
/** * Bind data to the view. * * @param View $view * @return void */ public function compose(View $view) { $timeslots = TimeSlot::with('djForTimeslot', 'showForTimeslot')->get(); $shows = WeeklySchedule::mergeFromTimeSlots($timeslots); $showSlides = $shows->getShowsForSlideshow(); $slides = Slides::forShows($showSlides); $events = Event::where('type', 'SLIDER')->where('date', '>=', Carbon::today('America/New_York'))->get(); if (!$events->isEmpty()) { $slides->addEvent($events->random()); } $view->with('slides', $slides); }