fix+add: seats + seat-chooser
This commit is contained in:
parent
2c6745e812
commit
b0cc5b5278
31 changed files with 808 additions and 115 deletions
|
@ -17,3 +17,28 @@ use Illuminate\Support\Facades\Route;
|
|||
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();
|
||||
});
|
||||
|
|
|
@ -21,25 +21,15 @@ Route::get('/', function () {
|
|||
|
||||
Route::get('/movies', function () {
|
||||
$s = new \App\Models\Showing();
|
||||
return view('main.movies', ['title' => "Movies", "showings" => $s->nowPlaying()->unique('movie_id')]);
|
||||
return view('main.movies.index', ['title' => "Movies", "showings" => $s->nowPlaying()->unique('movie_id')]);
|
||||
})->name('movies');
|
||||
|
||||
Route::get('/movie/{id}', function ($id) {
|
||||
$m = new \App\Models\Movie();
|
||||
$movie = $m->find($id);
|
||||
return view('main.movie', ['title' => $movie->movie_name, "movie" => $movie]);
|
||||
return view('main.movies.movie', ['title' => $movie->movie_name, "movie" => $movie]);
|
||||
})->name('movie');
|
||||
|
||||
Route::get('/cinemas', function () {
|
||||
return view('main.cinemas', ['title' => "Cinemas", "cinemas" => \App\Models\Cinema::all()]);
|
||||
})->name('cinemas');
|
||||
|
||||
Route::get('/cinema/{id}', function ($id) {
|
||||
$c = new \App\Models\Cinema();
|
||||
$cinema = $c->find($id);
|
||||
return view('main.cinema', ['title' => $cinema->cinema_name, "cinema" => $cinema]);
|
||||
})->name('cinema');
|
||||
|
||||
Auth::routes();
|
||||
|
||||
// account
|
||||
|
@ -50,6 +40,19 @@ Route::get('/dash', [App\Http\Controllers\UserDashController::class, 'index'])->
|
|||
// CRUD - Create Read Update Delete
|
||||
// FB - Frontend Backend
|
||||
|
||||
// main
|
||||
Route::get('/cinemas', [App\Http\Controllers\Main\CinemaController::class, 'showAllCinemas'])->name('cinemas');
|
||||
Route::get('/cinema/{id}', [App\Http\Controllers\Main\CinemaController::class, 'show'])->name('cinema');
|
||||
|
||||
Route::get('/showings', [App\Http\Controllers\Main\ShowingController::class, 'showAllShowings'])->name('showings');
|
||||
Route::get('/showing/{id}', [App\Http\Controllers\Main\ShowingController::class, 'show'])->name('showing');
|
||||
|
||||
Route::get('/movies', [App\Http\Controllers\Main\MovieController::class, 'showAllMovies'])->name('movies');
|
||||
Route::get('/movie/{id}', [App\Http\Controllers\Main\MovieController::class, 'show'])->name('movie');
|
||||
|
||||
Route::get('/genres', [App\Http\Controllers\Main\GenreController::class, 'showAllGenres'])->name('genres');
|
||||
Route::get('/genre/{id}', [App\Http\Controllers\Main\GenreController::class, 'show'])->name('genre');
|
||||
|
||||
// Employee Home Page
|
||||
Route::get('/manage', function () {
|
||||
if (!auth()->user()->atleast('employee')) {
|
||||
|
@ -114,11 +117,26 @@ Route::controller(\App\Http\Controllers\Managing\CinemaController::class)->group
|
|||
Route::delete('/manage/cinema/{id}', [\App\Http\Controllers\Managing\CinemaController::class, 'destroy'])->name('manage.cinema');
|
||||
});
|
||||
|
||||
Route::controller(\App\Http\Controllers\Managing\ShowingsController::class)->group(function () {
|
||||
// /manage/showings - CR showings (FB)
|
||||
Route::get('/manage/showings', [\App\Http\Controllers\Managing\ShowingsController::class, 'showAllShowings'])->name('manage.showings');
|
||||
Route::post('/manage/showings', [\App\Http\Controllers\Managing\ShowingsController::class, 'store'])->name('manage.showings');
|
||||
|
||||
// /manage/showings/create - C showing (F)
|
||||
Route::get('/manage/showings/create', [\App\Http\Controllers\Managing\ShowingsController::class, 'createShowing'])->name('manage.showings.create');
|
||||
// no post, handled by POST /showings
|
||||
|
||||
// /manage/showings/{id} - RUD showing (FB)
|
||||
Route::get('/manage/showing/{id}', [\App\Http\Controllers\Managing\ShowingsController::class, 'edit'])->name('manage.showing');
|
||||
Route::put('/manage/showing/{id}', [\App\Http\Controllers\Managing\ShowingsController::class, 'update'])->name('manage.showing');
|
||||
Route::delete('/manage/showing/{id}', [\App\Http\Controllers\Managing\ShowingsController::class, 'destroy'])->name('manage.showing');
|
||||
});
|
||||
|
||||
// /test/comp/{component}
|
||||
Route::get('/test/comp/{component}', function ($component) {
|
||||
switch ($component) {
|
||||
case 'seat-chooser':
|
||||
$c = new \App\View\Components\SeatChooser(1);
|
||||
$c = new \App\View\Components\SeatChooser(1, 1);
|
||||
return $c->render();
|
||||
default:
|
||||
return "No component found";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue