Skip to content

Commit

Permalink
Only display published tour stops in API [MA-165]
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhiltri committed Mar 4, 2024
1 parent 765b317 commit 42a17d8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/Models/Transformers/TourTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ public function transform(TwillModelContract $tour): array
protected function includeTourStops($tour)
{
$stops = $tour->stops->filter(function ($stop) {
return $stop->selector?->object?->is_on_view;
return $stop->selector?->object?->is_on_view
&& $stop->published
&& $stop->selector?->published
&& ($stop->selector?->object?->published ?? true);
});
return $this->collection($stops, new StopTransformer());
}
Expand Down

0 comments on commit 42a17d8

Please sign in to comment.