Bulletinboard/routes/web.php

87 lines
4.4 KiB
PHP

<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\IndexController;
use \App\Http\Controllers\AuthController;
use \App\Http\Controllers\PostController;
use \App\Http\Controllers\UserController;
use \App\Http\Controllers\ErrorController;
use \App\Http\Controllers\OccupationController;
use \App\Http\Controllers\StatusController;
use \App\Http\Controllers\TimePeriodController;
/*
|--------------------------------------------------------------------------
| 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('/', [ IndexController::class, 'index'])->name('index');
Route::get('/login', [ AuthController::class, 'loginView' ])->name('login-view');
Route::post('/login', [ AuthController::class, 'login' ])->name('login');
//Route::get("/register", [ AuthController::class, 'registerView' ])->name('register-view');
//Route::post('/register', [ AuthController::class, 'register' ])->name('register');
Route::get("/logout", [ AuthController::class, 'logout' ])->name('logout');
Route::get("/create-post", [ PostController::class, "create"])->name('create-post');
Route::post("/create-post", [ PostController::class, "store"])->name('store-post');
/*
* ADMIN ROUTES
*/
Route::get("/admin/posts", [ IndexController::class, "adminIndex" ])->name("admin-posts");
Route::get("/admin/posts/{post}/edit", [ PostController::class, "show" ])->name("admin-show-post");
Route::put("/admin/posts/{post}/edit", [ PostController::class, "update" ])->name("admin-edit-post");
Route::delete("/admin/posts/{post}", [ PostController::class, "destroy" ])->name("admin-delete-post");
Route::get("/admin/users", [ UserController::class, "index" ])->name("admin-users");
Route::get("/admin/users/{user}/edit", [ UserController::class, "edit" ])->name("admin-show-user");
Route::put("/admin/users/{user}/edit", [ UserController::class, "update" ])->name("admin-edit-user");
Route::delete("/admin/users/{user}", [ UserController::class, "destroy" ])->name("admin-delete-user");
Route::get("/admin/occupations", [ OccupationController::class, "index" ])->name("admin-occupations");
Route::get("/admin/occupations/create", [ OccupationController::class, "create" ])->name("admin-create-occupation");
Route::post("/admin/occupations/create", [ OccupationController::class, "store" ])->name("admin-store-occupation");
Route::get("/admin/occupations/{occupation}/edit", [ OccupationController::class, "edit" ])->name("admin-show-occupation");
Route::put("/admin/occupations/{occupation}/edit", [ OccupationController::class, "update" ])->name("admin-edit-occupation");
Route::delete("/admin/occupations/{occupation}", [ OccupationController::class, "destroy" ])->name("admin-delete-occupation");
Route::get("/admin/states", [ StatusController::class, "index" ])->name("admin-states");
Route::get("/admin/states/create", [ StatusController::class, "create" ])->name("admin-create-state");
Route::post("/admin/states/create", [ StatusController::class, "store" ])->name("admin-store-state");
Route::get("/admin/states/{status}/edit", [ StatusController::class, "show" ])->name("admin-show-state");
Route::put("/admin/states/{status}/edit", [ StatusController::class, "update" ])->name("admin-edit-state");
Route::delete("/admin/states/{status}", [ StatusController::class, "destroy" ])->name("admin-delete-state");
Route::get("/admin/time-periods", [ TimePeriodController::class, "index" ])->name("admin-time-periods");
Route::get("/admin/time-periods/create", [ TimePeriodController::class, "create" ])->name("admin-create-timeperiod");
Route::post("/admin/time-periods/create", [ TimePeriodController::class, "store" ])->name("admin-store-timeperiod");
Route::get("/admin/time-periods/{timePeriod}/edit", [ TimePeriodController::class, "show" ])->name("admin-show-timeperiod");
Route::put("/admin/time-periods/{timePeriod}/edit", [ TimePeriodController::class, "update" ])->name("admin-edit-timeperiod");
Route::delete("/admin/time-periods/{timePeriod}", [ TimePeriodController::class, "destroy" ])->name("admin-delete-timeperiod");
/*
* SEARCH ROUTES
*/
Route::get("/search", [ PostController::class, "index" ])->name("search-posts");
/*
* ERROR ROUTES
*/
Route::get("/error", [ ErrorController::class, "error" ])->name("error");