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 ...@@ -27,7 +27,7 @@ public function news(Request $request): JsonResponse
'title' => $item->title, 'title' => $item->title,
'excerpt' => $item->excerpt, 'excerpt' => $item->excerpt,
'category' => $item->category, '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(), 'published_at' => $item->published_at?->toIso8601String(),
'is_featured' => $item->is_featured, 'is_featured' => $item->is_featured,
]), ]),
...@@ -54,7 +54,7 @@ public function newsShow(string $uuid): JsonResponse ...@@ -54,7 +54,7 @@ public function newsShow(string $uuid): JsonResponse
'title' => $article->title, 'title' => $article->title,
'body' => $article->body, 'body' => $article->body,
'category' => $article->category, '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(), 'published_at' => $article->published_at?->toIso8601String(),
], ],
]); ]);
...@@ -104,7 +104,7 @@ public function events(): JsonResponse ...@@ -104,7 +104,7 @@ public function events(): JsonResponse
'starts_at' => $e->starts_at?->toIso8601String(), 'starts_at' => $e->starts_at?->toIso8601String(),
'ends_at' => $e->ends_at?->toIso8601String(), 'ends_at' => $e->ends_at?->toIso8601String(),
'location_name' => $e->location_name, '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, 'max_capacity' => $e->max_capacity,
'registrations_count' => $e->registrations_count, 'registrations_count' => $e->registrations_count,
'is_registration_open' => $e->isRegistrationOpen(), 'is_registration_open' => $e->isRegistrationOpen(),
...@@ -128,7 +128,7 @@ public function gallery(): JsonResponse ...@@ -128,7 +128,7 @@ public function gallery(): JsonResponse
return response()->json([ return response()->json([
'data' => $media->map(fn ($m) => [ 'data' => $media->map(fn ($m) => [
'id' => $m->id, 'id' => $m->id,
'url' => $m->url ? asset('storage/' . $m->url) : null, 'url' => $m->url ? $m->url : null,
'caption' => $m->caption, 'caption' => $m->caption,
'type' => $m->type, 'type' => $m->type,
'created_at' => $m->created_at?->toIso8601String(), '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