Skip to content

Commit

Permalink
feat: open bookings api endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
blt950 committed Apr 13, 2024
1 parent 95152e9 commit 38bd8ae
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/Http/Controllers/API/BookingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ public function index()
return response()->json(['data' => $bookings->values()], 200);
}

/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function indexAnon()
{
$bookings = Booking::select(['id', 'callsign', 'time_start', 'time_end', 'training', 'event', 'exam', 'created_at', 'updated_at'])->where('deleted', false)->get()->sortBy('time_start');

return response()->json(['data' => $bookings->values()], 200);
}

/**
* Store a newly created resource in storage.
*
Expand Down
2 changes: 2 additions & 0 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
|
*/

Route::get('/open/bookings', [App\Http\Controllers\API\BookingController::class, 'indexAnon'])->name('api.booking.index.anonymous');

Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user();
});
Expand Down

0 comments on commit 38bd8ae

Please sign in to comment.