File tree Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ Then run the following command to install the package:
53
53
``` bash
54
54
composer require niamulhasan/api-doctor-swagger
55
55
```
56
- ### Step: 4 Edit your ` config/app.php ` file
56
+ ### Step: 4 Edit your ` config/app.php ` file (Laravel 11 ` bootstrap/providers.php ` )
57
57
Add the following line to the ` providers ` array:
58
58
``` php
59
59
NiamulHasan\ApiDoctorSwagger\Providers\ApiDoctorProvider::class,
@@ -70,6 +70,16 @@ Run the following command to publish the package's config file:
70
70
];`
71
71
add this in your ` app/Http/Middleware/VerifyCsrfToken.php `
72
72
73
+ #### For Laravel 11: in ` bootstrap/app.php `
74
+ add ` $middleware->validateCsrfTokens(except: ['api/*']); ` in middleware
75
+ Like this
76
+ ``` php
77
+ ->withMiddleware(function (Middleware $middleware) {
78
+ $middleware->validateCsrfTokens(except: ['api/*']);
79
+ })
80
+ ```
81
+
82
+
73
83
74
84
## Usage
75
85
For now this package can generate doc only for ** URL parameters** and ** Request body** . It will not generate doc for ** Query parameters** .
Original file line number Diff line number Diff line change @@ -164,15 +164,19 @@ public static function buildParameters($parameters)
164
164
public static function buildProperties ($ rules )
165
165
{
166
166
$ result = "" ;
167
- foreach ($ rules as $ rule => $ value ) {
168
- preg_match ('/(.*?)\|/ ' , $ value , $ matches );
169
- $ type = $ matches [1 ];
170
- $ propertyString = "
167
+ try {
168
+ foreach ($ rules as $ rule => $ value ) {
169
+ preg_match ('/(.*?)\|/ ' , $ value , $ matches );
170
+ $ type = $ matches [1 ];
171
+ $ propertyString = "
171
172
{$ rule }:
172
173
type: string
173
174
description: {$ value }
174
175
" ;
175
- $ result .= $ propertyString ;
176
+ $ result .= $ propertyString ;
177
+ }
178
+ } catch (\Exception $ e ) {
179
+ // echo $e->getMessage();
176
180
}
177
181
return $ result ;
178
182
}
You can’t perform that action at this time.
0 commit comments