MicroFrameWork/rout.php

31 lines
2.1 KiB
PHP
Raw Normal View History

2024-07-29 15:57:20 +03:00
<?php
use app\controllers\MainController;
use kernel\App;
use Phroute\Phroute\RouteCollector;
App::$collector->get('/', [MainController::class, 'actionIndex']);
App::$collector->get('/example', [MainController::class, 'actionExample']);
App::$collector->group(["prefix" => "admin"], function (RouteCollector $router){
App::$collector->group(["prefix" => "user"], callback: function (RouteCollector $router){
App::$collector->get('/', [\app\controllers\UserController::class, 'actionIndex']);
2024-07-31 12:59:06 +03:00
App::$collector->get('/page/{page_number}', [\app\controllers\UserController::class, 'actionIndex']);
2024-07-29 15:57:20 +03:00
App::$collector->get('/create', [\app\controllers\UserController::class, 'actionCreate']);
App::$collector->post("/", [\app\controllers\UserController::class, 'actionAdd']);
App::$collector->get('/{id}', [\app\controllers\UserController::class, 'actionView']);
App::$collector->any('/update/{id}', [\app\controllers\UserController::class, 'actionUpdate']);
App::$collector->any("/edit/{id}", [\app\controllers\UserController::class, 'actionEdit']);
App::$collector->get('/delete/{id}', [\app\controllers\UserController::class, 'actionDelete']);
});
App::$collector->group(["prefix" => "post"], function (RouteCollector $router){
App::$collector->get('/', [\app\controllers\PostController::class, 'actionIndex']);
2024-08-07 15:30:45 +03:00
App::$collector->get('/page/{page_number}', [\app\controllers\PostController::class, 'actionIndex']);
2024-07-29 15:57:20 +03:00
App::$collector->get('/create', [\app\controllers\PostController::class, 'actionCreate']);
App::$collector->post("/", [\app\controllers\PostController::class, 'actionAdd']);
App::$collector->get('/{id}', [\app\controllers\PostController::class, 'actionView']);
App::$collector->any('/update/{id}', [\app\controllers\PostController::class, 'actionUpdate']);
App::$collector->any("/edit/{id}", [\app\controllers\PostController::class, 'actionEdit']);
App::$collector->get('/delete/{id}', [\app\controllers\PostController::class, 'actionDelete']);
});
});