Skip to content

Commit

Permalink
fix: api should return null on img if not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
blt950 committed Aug 2, 2024
1 parent 56fc8b5 commit e71f021
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/Http/Controllers/API/EventController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function index(Calendar $calendar)

// Set the full path on the image attribute
$events->transform(function ($event) {
$event->image = asset('storage/banners/' . $event->image);
$event->image = isset($event->image) ? asset('storage/banners/' . $event->image) : null;
return $event;
});

Expand Down

0 comments on commit e71f021

Please sign in to comment.