@@ -140,38 +140,54 @@ For extra documentation you can use markdown inside your controller method as we
140
140
< /p>
141
141
142
142
143
- # Extra
143
+ # Extra documentation
144
144
145
- You write extra documentation in markdown which will be rendered as HTML on the dashboard.
146
- Example of using it in the controller
145
+ You can write extra documentation in markdown using ` @lrd` in the PHPDoc on the ` rules` method of the ` Request` classes and on the controller methods.\
146
+ This will then be rendered as HTML on the dashboard.\
147
+ Documentation defined on the controller method is appended below documentation defined on the ` rules` method.\
148
+ Example of using it in the controller:
147
149
148
150
` ` ` php
149
151
/**
150
152
* @lrd:start
151
- * Hello markdown
153
+ * # Hello markdown
152
154
* Free ` code` or * text* to write documentation in markdown
153
155
* @lrd:end
154
156
* /
155
157
public function index(MyIndexRequest $request ): Resource
156
158
{
157
159
` ` `
158
160
159
- # Params not in rules
161
+ # Extra parameters
160
162
161
- You write extra params with rules with @LRDparam in the comment line as one line
163
+ You define extra parameters using ` @LRDparam` .\
164
+ You can use ` @LRDparam` in PHPDoc on both the ` rules` methods and the controller methods.\
165
+ You can also overwrite rules using ` @LRDparam` .
166
+ Meaning, when rules are defined in the ` rules` method, you can overwrite those rules using ` @LRDparam` in the PHPDoc above the ` rules` method.
167
+ And you can overwrite those rules using ` @LRDparam` in a PHPDoc on the controller methods.\
168
+ So, the precedence is ` Controller method PHPDoc` < ` Rules method PHPDoc` < ` Rules method values` .
162
169
163
170
` ` ` php
164
171
/**
165
172
* @LRDparam username string| max:32
166
173
* // either space or pipe
167
174
* @LRDparam nickaname string| nullable| max:32
168
175
* // override the default response codes
169
- * @LRDparam responses 200| 422
176
+ * @LRDresponses 200| 422
170
177
* /
171
178
public function index(MyIndexRequest $request ): Resource
172
179
{
173
180
` ` `
174
181
182
+ # Response codes
183
+ Without explicitly declaring response codes,
184
+ all routes are documented to return any of the response codes defined in the request-docs.php ` default_responses` configuration.\
185
+ However, using ` @LRDresponse 200| 422` (spaces or pipes) within the PHPDoc on your controller methods,
186
+ you are able to explicitly define what status codes can be returned by the server.
187
+
188
+ # Configuration
189
+ Please view the ` request-docs.php` config file to see how you can customise your experience.
190
+
175
191
# Testing
176
192
177
193
` ` ` bash
@@ -231,6 +247,7 @@ Fixing lints
231
247
- v2.16 Top Navbar is fixed
232
248
- v2.19 Publish _astro assets
233
249
- v2.25 ` laravel-request-docs:export` command to export
250
+ - v2.28 Allow extra documentation to be defined on the ` rules` method of the Request class. By @Ken-vdE
234
251
235
252
236
253
# Contributors
0 commit comments