42 lines
1.6 KiB
PHP
42 lines
1.6 KiB
PHP
<?php
|
|
|
|
use CodeIgniter\Router\RouteCollection;
|
|
|
|
// ------------------------------------------------------For Error Handling------------------------------------------------------ //
|
|
$routes->set404Override(function() {
|
|
$response = service('response');
|
|
$response->setStatusCode(404);
|
|
echo view('errors/notfound');
|
|
});
|
|
$routes->get('/unauthorized', 'ErrorPage::unauthorized');
|
|
|
|
|
|
// ------------------------------------------------------Basic Page and Login/Logout------------------------------------------------------ //
|
|
$routes->get('/', 'Home::index');
|
|
$routes->match(['get','post'],'/login', 'Auth::login', ['filter' => 'guest']);
|
|
$routes->get('/logout', 'Auth::logout');
|
|
|
|
|
|
// ------------------------------------------------------Page Based on Role------------------------------------------------------ //
|
|
$routes->group('admin', ['filter' => 'role:1'], function($routes) {
|
|
$routes->get('/', 'Admin::index');
|
|
$routes->get('user', 'User::index');
|
|
$routes->post('user/create', 'User::create');
|
|
$routes->post('user/update', 'User::update');
|
|
$routes->post('user/delete', 'User::delete');
|
|
});
|
|
|
|
$routes->group('doctor', ['filter' => 'role:2'], function($routes) {
|
|
$routes->get('/', 'Doctor::index');
|
|
});
|
|
|
|
$routes->group('analyst', ['filter' => 'role:3'], function($routes) {
|
|
$routes->get('/', 'Analyst::index');
|
|
});
|
|
|
|
$routes->group('cs', ['filter' => 'role:4'], function($routes) {
|
|
$routes->get('/', 'CustomerService::index');
|
|
});
|
|
|
|
// ------------------------------------------------------For API------------------------------------------------------ //
|
|
$routes->get('/api/dashboard', 'ApiDashboard::index'); |