Skip to content

Commit fad46f9

Browse files
committed
- Updated docs
1 parent 05b77e6 commit fad46f9

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

docs/generating-api-docs/adding-additional-fields.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,36 +60,79 @@ public static function apiDocAdditionalShowQueryParameters(): array
6060

6161
Use this method to specify additional fields that can be selected for the `index` endpoint.
6262

63+
```php
64+
public static function apiDocAdditionalIndexAllowedFields(): array
65+
{
66+
return [];
67+
}
68+
```
6369

6470
## apiDocAdditionalIndexAllowedAppends()
6571

6672
Use this method to specify additional model accessor fields (appends) that can be included in the `index` endpoint response.
6773

74+
```php
75+
public static function apiDocAdditionalIndexAllowedAppends(): array
76+
{
77+
return [];
78+
}
79+
```
6880

6981
## apiDocAdditionalShowAllowedFields()
7082

7183
Use this method to specify additional fields that can be selected for the `show` endpoint. By default, this returns the same fields as `apiDocAdditionalIndexAllowedFields()`.
7284

85+
```php
86+
public static function apiDocAdditionalShowAllowedFields(): array
87+
{
88+
return static::apiDocAdditionalIndexAllowedFields();
89+
}
90+
```
7391

7492
## apiDocAdditionalShowAllowedAppends()
7593

7694
Use this method to specify additional model accessor fields (appends) that can be included in the `show` endpoint response. By default, this returns the same appends as `apiDocAdditionalIndexAllowedAppends()`.
7795

96+
```php
97+
public static function apiDocAdditionalShowAllowedAppends(): array
98+
{
99+
return static::apiDocAdditionalIndexAllowedAppends();
100+
}
101+
```
78102

79103
## apiDocAdditionalAllowedSorts()
80104

81105
Use this method to specify additional fields that can be used for sorting results.
82106

107+
```php
108+
public static function apiDocAdditionalAllowedSorts(): array
109+
{
110+
return [];
111+
}
112+
```
83113

84114
## apiDocAdditionalAllowedIncludes()
85115

86116
Use this method to specify additional relations that can be included in the response.
87117

118+
```php
119+
public static function apiDocAdditionalAllowedIncludes(): array
120+
{
121+
return [];
122+
}
123+
```
88124

89125
## apiDocAdditionalAllowedFilters()
90126

91127
Use this method to specify additional filters that can be applied to the query. You can return both simple field names as strings or `AllowedFilter` instances for more complex filters.
92128

129+
```php
130+
public static function apiDocAdditionalAllowedFilters(): array
131+
{
132+
return [];
133+
}
134+
```
135+
93136
## apiFieldsDescription()
94137

95138
Use this method to override the default fields description or append to it.

0 commit comments

Comments
 (0)