cineflex/routes/api.php

45 lines
1.2 KiB
PHP
Raw Normal View History

2022-11-23 09:32:34 +01:00
<?php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
return $request->user();
});
2023-01-01 20:13:11 +01:00
// /api/cinemas/{id}/rooms
Route::get('/cinemas/{id}/rooms', function ($id) {
$cinema = (new App\Models\Cinema)->find($id);
return $cinema->rooms;
});
// /api/showings/{id}
Route::get('/showings/{id}', function ($id) {
$showing = (new App\Models\Showing)->find($id);
return $showing;
});
// /api/rooms/{id}/seatMatrix
Route::get('/rooms/{id}/seatMatrix', function ($id) {
$room = (new App\Models\Room)->find($id);
return $room->seatMatrix();
});
// /api/showings/{id}/seatMatrix
Route::get('/showings/{id}/seatMatrix', function ($id) {
$showing = (new App\Models\Showing)->find($id);
return $showing->seatMatrix();
});