You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
545 B

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class SwaggerController extends Controller
{
/**
* 返回JSON格式的Swagger定义
*/
public function getJSON()
{
if (config('app.debug')) {
$swagger = \OpenApi\Generator::scan([
app_path('Http/Controllers/Admin/'),
app_path('Http/Controllers/Mobile/'),
app_path('Http/Controllers/Controller.php')
]);
return response()->json($swagger, 200);
}
}
}