Skip to content

Commit

Permalink
Updating with the api to retrieve the latest event;
Browse files Browse the repository at this point in the history
  • Loading branch information
diego-maeda committed Aug 11, 2024
1 parent 72cebde commit 125404a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/Http/Controllers/EventsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,9 @@ public function findNext(Request $request): JsonResponse
}
}


public function latest(): JsonResponse
{
$event = Event::where('precinct', '33705')->latest('crime_date')->first();
return response()->json(['event' => $event]);
}
}
1 change: 1 addition & 0 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
Artisan::call('app:test-broadcast-command');
});

Route::get('/latest', [EventsController::class, 'latest']);
Route::post('/find-previous-event', [EventsController::class, 'findPrevious']);
Route::post('/find-next-event', [EventsController::class, 'findNext']);

Expand Down

0 comments on commit 125404a

Please sign in to comment.