Nav::get('/editContact', "{$controller}@editContact"); }); //Modified contactpage Nav::group('/admin', function () { $controller = 'AdminController'; Nav::post('/editedContact', "{$controller}@editedContact"); }); Nav::group('/admin', function () { $controller = 'AdminController'; Nav::get('/editedContact', "{$controller}@editedContact"); }); //edit Rating system Nav::group('/admin', function () { $controller = 'AdminController'; Nav::post('/editRating', "{$controller}@editRating"); }); Nav::group('/admin', function () { $controller = 'AdminController'; Nav::get('/editRating', "{$controller}@editRating"); }); //Modified Rating system Nav::group('/admin', function () { $controller = 'AdminController'; Nav::post('/editedRating', "{$controller}@editedRating"); }); Nav::group('/admin', function () { $controller = 'AdminController'; Nav::get('/editedRating', "{$controller}@editedRating"); }); Nav::start();
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <h1>hello admin</h1> <?php use Project\Classes\Router\Nav; Nav::drawMenu('admin'); ?> </body> </html>
use Project\Classes\Router\Nav; include "Nav.php"; include '../Helper.php'; include 'Route.php'; // A function makes example cleaner. function display($word) { return function () use($word) { echo $word; }; } Nav::group('/Classes/Router as Router Example', function () { Nav::get('/ as Home', display('Home')); Nav::get('/login as Login', display('Login')); Nav::get('/register as Register', display('Register')); Nav::group('/Classes/Router/register as Register', function () { Nav::get('/1 as sub menu 1', display('register sub page 1')); Nav::group('/Classes/Router/register/1 as sub menu 1', function () { Nav::get('/1 as R11', display('R11')); }); Nav::get('/2 as sub menu 2', display('register sub page 2')); }); Nav::get('/logout as Logout', display('Logout')); Nav::post('/login', display('Login post')); Nav::post('/register', display('Register Post')); }); Nav::start(); var_dump(json_encode(Nav::menu())); Nav::drawMenu('Router Example');