Esempio n. 1
0
    $controller = 'AdminController';
    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();
Esempio n. 2
0
<?php

/**
 * Created by PhpStorm.
 * User: yi
 * Date: 15/04/16
 * Time: 4:14 PM
 */
include '../../autoloader.php';
use Project\Classes\Request;
use Project\Classes\Router\Nav;
// single quote
$controller = '\\Project\\Examples\\admin\\AdminController';
Nav::group('/admin as admin', function () use($controller) {
    Nav::get('/home as Home', "{$controller}@home");
    // GET /admin/home
    Nav::get('/test/:id as Home', function ($id, Request $request) {
        var_dump($request);
        echo 'test' . $id;
    });
    // GET /admin/home
    Nav::get('/news as Admin news', "{$controller}@news");
    // GET /admin/new
    Nav::post('/home as Admin news', "{$controller}@home");
    // GET /admin/new
});
Nav::start();
Esempio n. 3
0
<?php

include '../autoloader.php';
use Project\Classes\Router\Nav;
Nav::group('/Api', function () {
    $menuController = 'Project\\Api\\MenuController';
    Nav::get('/menu', "{$menuController}@MenuAll");
    Nav::get('/menu/:name', "{$menuController}@Menu");
    Nav::post('/menu', "{$menuController}@SaveMenu");
    $pageController = 'Project\\Api\\PageController';
    Nav::get('/page', "{$pageController}@GetAll");
    Nav::post('/page', "{$pageController}@AddPage");
    Nav::get('/page/:id', "{$pageController}@GetPage");
    Nav::put('/page/:id', "{$pageController}@UpdatePage");
    Nav::delete('/page/:id', "{$pageController}@DeletePage");
});
Nav::start();
Esempio n. 4
0
<?php

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');
Esempio n. 5
0
namespace Project\Auth;

use Project\Classes\Router\Nav;
include '../autoloader.php';
Nav::group('/Auth as Auth', function () {
    $login = '******';
    Nav::get('/ as Home', "{$login}@home");
    Nav::get('/login as Login', "{$login}@loginPage");
    Nav::get('/admin', "{$login}@adminLoginPage");
    Nav::get('/logout as Logout', "{$login}@logout");
    Nav::get('/getLogin as Logout', "{$login}@getLogin");
    Nav::post('/login', "{$login}@processLogin");
    Nav::post('/admin', "{$login}@adminLogin");
});
Nav::group('/Auth as register', function () {
    $register = 'Project\\Auth\\controllers\\RegisterController';
    Nav::get('/register as Register', "{$register}@registerPage");
    Nav::post('/register', "{$register}@registerUser");
    Nav::post('/register/user', "{$register}@checkAvailability");
});
// Oauth
Nav::group('/Auth as OAuth', function () {
    $oauth = 'Project\\Auth\\controllers\\OAuthController';
    Nav::get('/login/github', "{$oauth}@github");
});
Nav::start();
?>



<?php