"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('/showing/{id}/order', [App\Http\Controllers\Main\ShowingController::class, 'order'])->name('showing.order'); Route::get('/movies', [App\Http\Controllers\Main\MovieController::class, 'moviesNowShowing'])->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, 'index'])->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, 'index'])->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, 'index'])->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, 'index'])->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'); }); Route::controller(\App\Http\Controllers\Managing\UsersController::class)->group(function () { // /manage/users - CR users (FB) Route::get('/manage/users', [\App\Http\Controllers\Managing\UsersController::class, 'index'])->name('manage.users'); Route::post('/manage/users', [\App\Http\Controllers\Managing\UsersController::class, 'store'])->name('manage.users'); // /manage/users/create - C user (F) Route::get('/manage/users/create', [\App\Http\Controllers\Managing\UsersController::class, 'createUser'])->name('manage.users.create'); // no post, handled by POST /users // /manage/users/{id} - RUD user (FB) Route::get('/manage/user/{id}', [\App\Http\Controllers\Managing\UsersController::class, 'show'])->name('manage.user'); Route::put('/manage/user/{id}', [\App\Http\Controllers\Managing\UsersController::class, 'update'])->name('manage.user'); Route::delete('/manage/user/{id}', [\App\Http\Controllers\Managing\UsersController::class, 'destroy'])->name('manage.user'); });