<?php
 namespace ModStart\App\Api; use Illuminate\Support\Facades\Route; use ModStart\Module\ModuleManager; class ModStartApi { public static function registerModuleRoutes() { $modules = ModuleManager::listAllInstalledModules(); foreach ($modules as $module => $_) { if (file_exists($file = ModuleManager::path($module, 'Api/routes.php'))) { Route::group([ 'prefix' => config('modstart.api.prefix'), 'middleware' => ['api.bootstrap', 'api.session'], 'namespace' => "\\Module\\$module\\Api\\Controller", ], function ($router) use ($file) { require $file; }); } } if (file_exists($routes = modstart_api_path('routes.php'))) { require $routes; } } }