Changeset 5372778 for routes


Ignore:
Timestamp:
08/26/24 14:20:34 (4 months ago)
Author:
bube-ristovska <ristovska725@…>
Branches:
main
Children:
3c89e27
Parents:
8a258ab
Message:

Middleware for permissions based on officer, policeman or both

File:
1 edited

Legend:

Unmodified
Added
Removed
  • routes/web.php

    r8a258ab r5372778  
    1919*/
    2020
    21 Route::get('/', function () {
    22     return view('welcome');
    23 });
     21// UNAUTHORIZED
    2422Route::get('/login', function () {
    2523    return view('login');
    2624
    2725});
    28 
    2926Route::post('/login', [SessionsController::class, 'store']);
    3027
     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'
    3131
     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');
     36
     37// OFFICER
     38Route::get('register-policeman', [OfficerController::class, 'register'])->middleware('officer');
     39Route::post('register-policeman', [OfficerController::class, 'register_post'])->middleware('officer');
     40
     41// BOTH
     42Route::get('/', function () {
     43    return view('welcome');
     44})->middleware('both');
    3245Route::get('logout', [SessionsController::class, 'logout']);
    3346
     47Route::get('employees', [OfficerController::class, 'employees'])->middleware('both');
     48Route::get('/employees/{id}', [OfficerController::class, 'show'])->middleware('both');
    3449
     50Route::get('filter', [PeopleController::class, 'filter'])->middleware('both');
     51Route::post('filter', [PeopleController::class, 'filter_post'])->middleware('both');
    3552
    36 Route::get('employees', [OfficerController::class, 'employees'])->middleware('guest');
    37 Route::get('/employees/{id}', [OfficerController::class, 'show']);
     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');
    3856
    39 Route::get('filter', [PeopleController::class, 'filter'])->middleware('guest');
    40 Route::post('filter', [PeopleController::class, 'filter_post'])->middleware('guest');
    41 
    42 Route::get('cases', [CrimeCaseController::class, 'cases'])->middleware('guest');
    43 
    44 Route::get('case/{wildcard}', [CrimeCaseController::class, 'case'])->name('case')->middleware('guest');
    45 
    46 Route::get('finished_cases', [CrimeCaseController::class, 'finished_cases'])->middleware('guest');
    47 
    48 
    49 Route::get('register-policeman', [OfficerController::class, 'register'])->middleware('guest');
    50 Route::post('register-policeman', [OfficerController::class, 'register_post'])->middleware('guest');
    51 
    52 Route::get('register-statement', [CrimeCaseController::class, 'register_statement'])->middleware('guest');
    53 Route::post('register-statement', [CrimeCaseController::class, 'register_statement_post'])->middleware('guest');
    54 
    55 
    56 
    57 Route::post('/get-person', [PeopleController::class, 'getPerson']);
     57Route::post('/get-person', [PeopleController::class, 'getPerson'])->middleware('both');
Note: See TracChangeset for help on using the changeset viewer.