144 lines
7.2 KiB
PHP
144 lines
7.2 KiB
PHP
<?php
|
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Web Routes
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Here is where you can register web routes for your application. These
|
|
| routes are loaded by the RouteServiceProvider within a group which
|
|
| contains the "web" middleware group. Now create something great!
|
|
|
|
|
*/
|
|
|
|
Route::get('/', function () {
|
|
$s = new \App\Models\Showing();
|
|
return view('main.home', ['title' => "Home", "showings" => $s->nowPlaying()->unique('movie_id'), "cinemas" => \App\Models\Cinema::all()]);
|
|
})->name('home');
|
|
|
|
Route::get('/movies', function () {
|
|
$s = new \App\Models\Showing();
|
|
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.movies.movie', ['title' => $movie->movie_name, "movie" => $movie]);
|
|
})->name('movie');
|
|
|
|
Auth::routes();
|
|
|
|
// account
|
|
Route::get('/logout', [App\Http\Controllers\Auth\LoginController::class, 'logout'])->name('logout');
|
|
Route::get('/dash', [App\Http\Controllers\UserDashController::class, 'index'])->name('dash');
|
|
|
|
// FORMAT: {ROUTE} - {C &| R &| U &| D} {what} {F || B}
|
|
// 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')) {
|
|
return redirect()->route('home');
|
|
}
|
|
return view('manage.index', [
|
|
'title' => "Manage",
|
|
'user' => auth()->user(),
|
|
'users' => \App\Models\User::all(),
|
|
'showings' => \App\Models\Showing::all(),
|
|
'movies' => \App\Models\Movie::all(),
|
|
'genres' => \App\Models\Genre::all(),
|
|
]);
|
|
})->name('manage');
|
|
|
|
|
|
|
|
Route::controller(\App\Http\Controllers\Managing\MovieController::class)->group(function () {
|
|
|
|
|
|
// /manage/movies - CR movies (FB)
|
|
Route::get('/manage/movies', [\App\Http\Controllers\Managing\MovieController::class, 'showAllMovies'])->name('manage.movies');
|
|
Route::post('/manage/movies', [\App\Http\Controllers\Managing\MovieController::class, 'store'])->name('manage.movies');
|
|
|
|
// /manage/movies/create - C movie (F)
|
|
Route::get('/manage/movies/create', [\App\Http\Controllers\Managing\MovieController::class, 'createMovie'])->name('manage.movies.create');
|
|
// no post, handled by POST /movies
|
|
|
|
// /manage/movies/{id} - RUD movie (FB)
|
|
Route::get('/manage/movie/{id}', [\App\Http\Controllers\Managing\MovieController::class, 'edit'])->name('manage.movie');
|
|
Route::put('/manage/movie/{id}', [\App\Http\Controllers\Managing\MovieController::class, 'update'])->name('manage.movie');
|
|
Route::delete('/manage/movie/{id}', [\App\Http\Controllers\Managing\MovieController::class, 'destroy'])->name('manage.movie');
|
|
});
|
|
|
|
Route::controller(\App\Http\Controllers\Managing\GenreController::class)->group(function () {
|
|
// /manage/genres - CR genres (FB)
|
|
Route::get('/manage/genres', [\App\Http\Controllers\Managing\GenreController::class, 'showAllGenres'])->name('manage.genres');
|
|
Route::post('/manage/genres', [\App\Http\Controllers\Managing\GenreController::class, 'store'])->name('manage.genres');
|
|
|
|
// /manage/genres/create - C genre (F)
|
|
Route::get('/manage/genres/create', [\App\Http\Controllers\Managing\GenreController::class, 'createGenre'])->name('manage.genres.create');
|
|
// no post, handled by POST /genres
|
|
|
|
// /manage/genres/{id} - RUD genre (FB)
|
|
Route::get('/manage/genre/{id}', [\App\Http\Controllers\Managing\GenreController::class, 'edit'])->name('manage.genre');
|
|
Route::put('/manage/genre/{id}', [\App\Http\Controllers\Managing\GenreController::class, 'update'])->name('manage.genre');
|
|
Route::delete('/manage/genre/{id}', [\App\Http\Controllers\Managing\GenreController::class, 'destroy'])->name('manage.genre');
|
|
});
|
|
|
|
Route::controller(\App\Http\Controllers\Managing\CinemaController::class)->group(function () {
|
|
// /manage/cinemas - CR cinemas (FB)
|
|
Route::get('/manage/cinemas', [\App\Http\Controllers\Managing\CinemaController::class, 'showAllCinemas'])->name('manage.cinemas');
|
|
Route::post('/manage/cinemas', [\App\Http\Controllers\Managing\CinemaController::class, 'store'])->name('manage.cinemas');
|
|
|
|
// /manage/cinemas/create - C cinema (F)
|
|
Route::get('/manage/cinemas/create', [\App\Http\Controllers\Managing\CinemaController::class, 'createCinema'])->name('manage.cinemas.create');
|
|
// no post, handled by POST /cinemas
|
|
|
|
// /manage/cinemas/{id} - RUD cinema (FB)
|
|
Route::get('/manage/cinema/{id}', [\App\Http\Controllers\Managing\CinemaController::class, 'edit'])->name('manage.cinema');
|
|
Route::put('/manage/cinema/{id}', [\App\Http\Controllers\Managing\CinemaController::class, 'update'])->name('manage.cinema');
|
|
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, 1);
|
|
return $c->render();
|
|
default:
|
|
return "No component found";
|
|
}
|
|
})->name('test.comp');
|