MicroFrameWork/kernel/modules/post/routs/post.php

28 lines
1.7 KiB
PHP
Raw Permalink Normal View History

<?php
use kernel\App;
2024-10-07 16:13:46 +03:00
use kernel\CgRouteCollector;
use Phroute\Phroute\RouteCollector;
2024-10-22 11:09:35 +03:00
App::$collector->filter('bearer', [\kernel\modules\secure\middlewares\BearerAuthMiddleware::class, "handler"]);
App::$collector->group(["prefix" => "admin"], function (RouteCollector $router){
2024-10-17 16:47:04 +03:00
App::$collector->group(["before" => "auth"], function (RouteCollector $router) {
App::$collector->group(["prefix" => "post"], function (RouteCollector $router) {
App::$collector->get('/', [\kernel\modules\post\controllers\PostController::class, 'actionIndex']);
App::$collector->get('/page/{page_number}', [\kernel\modules\post\controllers\PostController::class, 'actionIndex']);
App::$collector->get('/create', [\kernel\modules\post\controllers\PostController::class, 'actionCreate']);
App::$collector->post("/", [\kernel\modules\post\controllers\PostController::class, 'actionAdd']);
2024-10-31 16:12:02 +03:00
App::$collector->get('/view/{id}', [\kernel\modules\post\controllers\PostController::class, 'actionView']);
2024-10-17 16:47:04 +03:00
App::$collector->any('/update/{id}', [\kernel\modules\post\controllers\PostController::class, 'actionUpdate']);
App::$collector->any("/edit/{id}", [\kernel\modules\post\controllers\PostController::class, 'actionEdit']);
App::$collector->get('/delete/{id}', [\kernel\modules\post\controllers\PostController::class, 'actionDelete']);
});
});
2024-09-26 14:47:13 +03:00
});
2024-10-07 16:13:46 +03:00
App::$collector->group(["prefix" => "api"], function (CgRouteCollector $router){
2024-10-22 11:09:35 +03:00
App::$collector->group(['before' => 'bearer'], function (CgRouteCollector $router){
$router->rest("post", [\kernel\modules\post\controllers\PostRestController::class]);
});
});