Commit 02675f8e authored by Mahmoud Aglan's avatar Mahmoud Aglan

Fix double-prefixed media URLs in API responses

Media->url accessor already returns full URL via Storage::url().
Remove redundant asset('storage/') wrapping.
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 25cefe7c
......@@ -27,7 +27,7 @@ public function news(Request $request): JsonResponse
'title' => $item->title,
'excerpt' => $item->excerpt,
'category' => $item->category,
'image_url' => $item->image?->url ? asset('storage/' . $item->image->url) : null,
'image_url' => $item->image?->url ? $item->image->url : null,
'published_at' => $item->published_at?->toIso8601String(),
'is_featured' => $item->is_featured,
]),
......@@ -54,7 +54,7 @@ public function newsShow(string $uuid): JsonResponse
'title' => $article->title,
'body' => $article->body,
'category' => $article->category,
'image_url' => $article->image?->url ? asset('storage/' . $article->image->url) : null,
'image_url' => $article->image?->url ? $article->image->url : null,
'published_at' => $article->published_at?->toIso8601String(),
],
]);
......@@ -104,7 +104,7 @@ public function events(): JsonResponse
'starts_at' => $e->starts_at?->toIso8601String(),
'ends_at' => $e->ends_at?->toIso8601String(),
'location_name' => $e->location_name,
'cover_url' => $e->cover?->url ? asset('storage/' . $e->cover->url) : null,
'cover_url' => $e->cover?->url ? $e->cover->url : null,
'max_capacity' => $e->max_capacity,
'registrations_count' => $e->registrations_count,
'is_registration_open' => $e->isRegistrationOpen(),
......@@ -128,7 +128,7 @@ public function gallery(): JsonResponse
return response()->json([
'data' => $media->map(fn ($m) => [
'id' => $m->id,
'url' => $m->url ? asset('storage/' . $m->url) : null,
'url' => $m->url ? $m->url : null,
'caption' => $m->caption,
'type' => $m->type,
'created_at' => $m->created_at?->toIso8601String(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment