1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- /**
- * +----------------------------------------------------------------------
- * | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
- * +----------------------------------------------------------------------
- * | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
- * +----------------------------------------------------------------------
- * | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
- * +----------------------------------------------------------------------
- * | Author: CRMEB Team <admin@crmeb.com>
- * +----------------------------------------------------------------------
- */
- use think\facade\Route;
- /**
- * crud 自动加载路由
- * 自动加载crud目录下的所有路由文件
- */
- Route::group(function () {
- $path = $this->app->getRootPath() . 'app' . DS . 'adminapi' . DS . 'route' . DS . 'crud';
- if (is_dir($path)) {
- $files = scandir($path);
- foreach ($files as $file) {
- if ($file != '.' && $file != '..') {
- include $path . DS . $file;
- }
- }
- }
- })->middleware([
- \app\http\middleware\AllowOriginMiddleware::class,
- \app\adminapi\middleware\AdminAuthTokenMiddleware::class,
- \app\adminapi\middleware\AdminCheckRoleMiddleware::class,
- \app\adminapi\middleware\AdminLogMiddleware::class
- ])->option(['mark' => 'crud', 'mark_name' => '生成代码路由']);
|