Skip to content

Commit

Permalink
feat: added link to event for api
Browse files Browse the repository at this point in the history
  • Loading branch information
blt950 committed Aug 2, 2024
1 parent 10300f9 commit e7648eb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/Http/Controllers/API/EventController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ public function index(Calendar $calendar)
->events()
->get();

// Set the full path on the image attribute
// Set the full path on the image attribute and add a full url to event
$events->transform(function ($event) {
$event->image = isset($event->image) ? asset('storage/banners/' . $event->image) : null;
$event->link = route('events.show', $event->id);
return $event;
});

Expand Down

0 comments on commit e7648eb

Please sign in to comment.