Skip to content

Commit 5de293a

Browse files
authored
Merge pull request #626 from HiEventsDev/develop
2 parents fe21007 + b332963 commit 5de293a

File tree

14 files changed

+504
-445
lines changed

14 files changed

+504
-445
lines changed

backend/app/Helper/Url.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,26 @@ public static function getApiUrl(string $path, array $queryParams = []): string
2929
return self::addQueryParamsToUrl($queryParams, $url);
3030
}
3131

32+
/**
33+
* Generates a CDN URL for the given path if a CDN URL is configured.
34+
* Falls back to generating a URL using the specified or default filesystem disk.
35+
*
36+
* @param string $path The relative path to the asset.
37+
* @return string The fully qualified URL to the asset, either via CDN or storage disk.
38+
*/
3239
public static function getCdnUrl(string $path): string
3340
{
34-
return config('app.cnd_url') . '/' . $path;
41+
// Fetch the CDN URL from environment variables
42+
// Checking against the env variable instead of config() as config falls back to the default value
43+
// and we want to ensure that if the env variable is not set, we do not use a default value.
44+
$envCDNUrl = env('APP_CDN_URL');
45+
46+
if ($envCDNUrl) {
47+
return $envCDNUrl . '/' . $path;
48+
}
49+
50+
$disk = config('filesystems.public', 'public');
51+
return app('filesystem')->disk($disk)->url($path);
3552
}
3653

3754
private static function addQueryParamsToUrl(array $queryParams, mixed $url): mixed

backend/app/Services/Application/Handlers/EventSettings/PartialUpdateEventSettingsHandler.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ public function handle(PartialUpdateEventSettingsDTO $eventSettingsDTO): EventSe
6565

6666
'order_timeout_in_minutes' => $eventSettingsDTO->settings['order_timeout_in_minutes'] ?? $existingSettings->getOrderTimeoutInMinutes(),
6767
'website_url' => $eventSettingsDTO->settings['website_url'] ?? $existingSettings->getWebsiteUrl(),
68-
'maps_url' => $eventSettingsDTO->settings['maps_url'] ?? $existingSettings->getMapsUrl(),
68+
'maps_url' => array_key_exists('maps_url', $eventSettingsDTO->settings)
69+
? $eventSettingsDTO->settings['maps_url']
70+
: $existingSettings->getMapsUrl(),
6971
'location_details' => $locationDetails,
7072
'is_online_event' => $eventSettingsDTO->settings['is_online_event'] ?? $existingSettings->getIsOnlineEvent(),
7173
'online_event_connection_details' => array_key_exists('online_event_connection_details', $eventSettingsDTO->settings)

backend/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"php": "^8.2",
1010
"ext-intl": "*",
1111
"barryvdh/laravel-dompdf": "^3.0",
12-
"brick/money": "^0.8.0",
12+
"brick/money": "^0.10.1",
1313
"doctrine/dbal": "^3.6",
1414
"ezyang/htmlpurifier": "^4.17",
1515
"guzzlehttp/guzzle": "^7.2",

0 commit comments

Comments
 (0)