MicroFrameWork/kernel/templates/routs/kernel_routs_template
2024-12-10 17:01:25 +03:00

20 lines
1.3 KiB
Plaintext

<?php
use kernel\App;
use kernel\CgRouteCollector;
use Phroute\Phroute\RouteCollector;
App::$collector->group(["prefix" => "admin"], function (CgRouteCollector $router) {
App::$collector->group(["before" => "auth"], function (RouteCollector $router) {
App::$collector->group(["prefix" => "{slug}"], function (CGRouteCollector $router) {
App::$collector->get('/', [\app\modules\{slug}\controllers\{model}Controller::class, 'actionIndex']);
App::$collector->get('/page/{page_number}', [\app\modules\{slug}\controllers\{model}Controller::class, 'actionIndex']);
App::$collector->get('/create', [\app\modules\{slug}\controllers\{model}Controller::class, 'actionCreate']);
App::$collector->post("/", [\app\modules\{slug}\controllers\{model}Controller::class, 'actionAdd']);
App::$collector->get('/view/{id}', [\app\modules\{slug}\controllers\{model}Controller::class, 'actionView']);
App::$collector->any('/update/{id}', [\app\modules\{slug}\controllers\{model}Controller::class, 'actionUpdate']);
App::$collector->any("/edit/{id}", [\app\modules\{slug}\controllers\{model}Controller::class, 'actionEdit']);
App::$collector->get('/delete/{id}', [\app\modules\{slug}\controllers\{model}Controller::class, 'actionDelete']);
});
});
});