Skip to content

Commit 811b058

Browse files
Merge pull request #318 from Ken-vdE/update-readme-v2.28
update-readme-v2.28
2 parents 789ebfa + 86e9a43 commit 811b058

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

README.md

+24-7
Original file line numberDiff line numberDiff line change
@@ -140,38 +140,54 @@ For extra documentation you can use markdown inside your controller method as we
140140
</p>
141141
142142
143-
# Extra
143+
# Extra documentation
144144
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:
147149
148150
```php
149151
/**
150152
* @lrd:start
151-
* Hello markdown
153+
* # Hello markdown
152154
* Free `code` or *text* to write documentation in markdown
153155
* @lrd:end
154156
*/
155157
public function index(MyIndexRequest $request): Resource
156158
{
157159
```
158160
159-
# Params not in rules
161+
# Extra parameters
160162
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`.
162169
163170
```php
164171
/**
165172
* @LRDparam username string|max:32
166173
* // either space or pipe
167174
* @LRDparam nickaname string|nullable|max:32
168175
* // override the default response codes
169-
* @LRDparam responses 200|422
176+
* @LRDresponses 200|422
170177
*/
171178
public function index(MyIndexRequest $request): Resource
172179
{
173180
```
174181
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+
175191
# Testing
176192
177193
```bash
@@ -231,6 +247,7 @@ Fixing lints
231247
- v2.16 Top Navbar is fixed
232248
- v2.19 Publish _astro assets
233249
- 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
234251
235252
236253
# Contributors

0 commit comments

Comments
 (0)