PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.16
Yatra – Travel Booking & Tour Operator Software v3.0.16
3.0.16 3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 All 84 releases
← All changes | app/Models/Trip.php +36 -2 3.0.4 → 3.0.16 View file →
@@ -233,8 +233,17 @@
233 233 public array $tags = [];
234 234 public array $included_items = [];
235 235 public array $excluded_items = [];
236 236 public array $gallery_images = [];
237 + // Media arrays computed in SingleTripController::prepareTrip(). These MUST be
238 + // declared so Trip::fromStdClass() (which only copies declared properties via
239 + // property_exists) carries them onto the model — otherwise the single-trip
240 + // hero media switcher reads empty arrays and the Video / 360° / Documents
241 + // buttons never render even when video_url / virtual_tour_url are set.
242 + public array $videos = [];
243 + public array $youtube_videos = [];
244 + public array $virtual_tours = [];
245 + public array $documents = [];
237 246 public array $price_types = [];
238 247 public array $itinerary_days = [];
239 248 public array $faqs = [];
240 249 public array $frontend_tabs = [];
@@ -1125,16 +1134,19 @@
1125 1134 */
1126 1135 public function getDuration(): array
1127 1136 {
1128 1137 $duration = '';
1129 - if (!empty($this->duration_days)) {
1138 + if ($this->isHoursBased()) {
1139 + $duration = yatra_format_duration(0, null, $this->getDurationHours());
1140 + } elseif (!empty($this->duration_days)) {
1130 1141 $duration = yatra_format_duration($this->duration_days, $this->duration_nights ?? null);
1131 1142 }
1132 -
1143 +
1133 1144 return [
1134 1145 'formatted' => $duration,
1135 1146 'days' => $this->duration_days ?? 0,
1136 1147 'nights' => $this->duration_nights ?? 0,
1148 + 'hours' => $this->getDurationHours(),
1137 1149 'has_duration' => !empty($duration)
1138 1150 ];
1139 1151 }
1140 1152
@@ -1551,8 +1563,30 @@
1551 1563 */
1552 1564 public function getDurationNights(): int
1553 1565 {
1554 1566 return $this->duration_nights ?? 0;
1567 + }
1568 +
1569 + /**
1570 + * Duration in hours for hour-based (single-day) tours. 0 when the tour is
1571 + * day-based (the default) — see {@see self::isHoursBased()}.
1572 + */
1573 + public function getDurationHours(): int
1574 + {
1575 + return (int) ($this->duration_hours ?? 0);
1576 + }
1577 +
1578 + /**
1579 + * Whether this tour's duration is expressed in hours rather than days.
1580 + *
1581 + * True only when a positive `duration_hours` is set — so every existing
1582 + * (day-based) trip returns false and keeps its current behaviour. Used by
1583 + * the front-end duration display and the Google Calendar module to build a
1584 + * same-day timed event instead of a multi-day span.
1585 + */
1586 + public function isHoursBased(): bool
1587 + {
1588 + return $this->getDurationHours() > 0;
1555 1589 }
1556 1590
1557 1591 /**
1558 1592 * Raw difficulty classification ID on the trip row (not a human-readable label).