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.
20 lines
452 B
20 lines
452 B
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
class SwaggerController extends Controller
|
|
{
|
|
/**
|
|
* 返回JSON格式的Swagger定义
|
|
*/
|
|
public function getJSON()
|
|
{
|
|
if (!config('app.debug') || !config('app.swagger_enabled') || app()->environment('production')) {
|
|
abort(404);
|
|
}
|
|
|
|
$swagger = \OpenApi\Generator::scan([app_path('Http/Controllers/')]);
|
|
return response()->json($swagger, 200);
|
|
}
|
|
}
|