source: routes/web.php@ 3c89e27

main
Last change on this file since 3c89e27 was 5372778, checked in by bube-ristovska <ristovska725@…>, 3 months ago

Middleware for permissions based on officer, policeman or both

  • Property mode set to 100644
File size: 2.2 KB
RevLine 
[c454c0f]1<?php
2
[75151c6]3use App\Http\Controllers\CrimeCaseController;
4use App\Http\Controllers\OfficerController;
5use App\Http\Controllers\PeopleController;
6use App\Http\Controllers\SessionsController;
[c454c0f]7use Illuminate\Support\Facades\Route;
[d9c4096]8use Illuminate\Support\Facades\Session;
[c454c0f]9
10/*
11|--------------------------------------------------------------------------
12| Web Routes
13|--------------------------------------------------------------------------
14|
15| Here is where you can register web routes for your application. These
16| routes are loaded by the RouteServiceProvider and all of them will
17| be assigned to the "web" middleware group. Make something great!
18|
19*/
20
[5372778]21// UNAUTHORIZED
[c454c0f]22Route::get('/login', function () {
23 return view('login');
[cf84baa]24
[c454c0f]25});
[cf84baa]26Route::post('/login', [SessionsController::class, 'store']);
27
[5372778]28Route::get('/unauth', function () {
29 return view('unauth'); // Make sure there is a view file named `unauth.blade.php`
30})->name('unauth'); // Name the route 'unauth'
[cf84baa]31
[5372778]32// AUTHORIZED
33// POLICEMAN
34Route::get('register-statement', [CrimeCaseController::class, 'register_statement'])->middleware('policeman');
35Route::post('register-statement', [CrimeCaseController::class, 'register_statement_post'])->middleware('policeman');
[249bf91]36
[5372778]37// OFFICER
38Route::get('register-policeman', [OfficerController::class, 'register'])->middleware('officer');
39Route::post('register-policeman', [OfficerController::class, 'register_post'])->middleware('officer');
[cf84baa]40
[5372778]41// BOTH
42Route::get('/', function () {
43 return view('welcome');
44})->middleware('both');
45Route::get('logout', [SessionsController::class, 'logout']);
[6b10b67]46
[5372778]47Route::get('employees', [OfficerController::class, 'employees'])->middleware('both');
48Route::get('/employees/{id}', [OfficerController::class, 'show'])->middleware('both');
[768f473]49
[5372778]50Route::get('filter', [PeopleController::class, 'filter'])->middleware('both');
51Route::post('filter', [PeopleController::class, 'filter_post'])->middleware('both');
[768f473]52
[5372778]53Route::get('cases', [CrimeCaseController::class, 'cases'])->middleware('both');
54Route::get('case/{wildcard}', [CrimeCaseController::class, 'case'])->middleware('both');
55Route::get('finished_cases', [CrimeCaseController::class, 'finished_cases'])->middleware('both');
[768f473]56
[5372778]57Route::post('/get-person', [PeopleController::class, 'getPerson'])->middleware('both');
Note: See TracBrowser for help on using the repository browser.