Skip to content

Commit

Permalink
fix: api sort events by first and only from today
Browse files Browse the repository at this point in the history
  • Loading branch information
blt950 committed Aug 3, 2024
1 parent 21af121 commit d7a30e9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/Http/Controllers/API/EventController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ public function index(Calendar $calendar)
{
$events = $calendar
->events()
->where('start_date', '>=', Carbon::today())
->orderBy('start_date', 'asc')
->get();


// 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;
Expand Down

0 comments on commit d7a30e9

Please sign in to comment.