cineflex/routes/api.php

44 lines
1.2 KiB
PHP

<?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();
});
// /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();
});