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:
5353``` bash
5454composer require niamulhasan/api-doctor-swagger
5555```
56- ### Step: 4 Edit your ` config/app.php ` file
56+ ### Step: 4 Edit your ` config/app.php ` file (Laravel 11 ` bootstrap/providers.php ` )
5757Add the following line to the ` providers ` array:
5858``` php
5959NiamulHasan\ApiDoctorSwagger\Providers\ApiDoctorProvider::class,
@@ -70,6 +70,16 @@ Run the following command to publish the package's config file:
7070 ];`
7171add this in your ` app/Http/Middleware/VerifyCsrfToken.php `
7272
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+
7383
7484## Usage
7585For 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)
164164 public static function buildProperties ($ rules )
165165 {
166166 $ 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 = "
171172 {$ rule }:
172173 type: string
173174 description: {$ value }
174175 " ;
175- $ result .= $ propertyString ;
176+ $ result .= $ propertyString ;
177+ }
178+ } catch (\Exception $ e ) {
179+ // echo $e->getMessage();
176180 }
177181 return $ result ;
178182 }
You can’t perform that action at this time.
0 commit comments