1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-20 19:07:03 +08:00
2020-04-03 19:20:46 +08:00

41 lines
762 B
PHP

<?php
namespace App\Http\Api\Controllers;
/**
* @RoutePrefix("/api")
*/
class IndexController extends Controller
{
/**
* @Get("/", name="api.index")
*/
public function indexAction()
{
}
/**
* @Get("/routes", name="api.routes")
*/
public function routesAction()
{
$definitions = [];
$routes = $this->router->getRoutes();
foreach ($routes as $route) {
if (strpos($route->getPattern(), '/api') !== false) {
$definitions[] = [
'pattern' => $route->getPattern(),
'methods' => $route->getHttpMethods(),
];
}
}
return $this->jsonSuccess(['routes' => $definitions]);
}
}