You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/generating-api-docs/adding-additional-fields.md
+43Lines changed: 43 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,36 +60,79 @@ public static function apiDocAdditionalShowQueryParameters(): array
60
60
61
61
Use this method to specify additional fields that can be selected for the `index` endpoint.
62
62
63
+
```php
64
+
public static function apiDocAdditionalIndexAllowedFields(): array
65
+
{
66
+
return [];
67
+
}
68
+
```
63
69
64
70
## apiDocAdditionalIndexAllowedAppends()
65
71
66
72
Use this method to specify additional model accessor fields (appends) that can be included in the `index` endpoint response.
67
73
74
+
```php
75
+
public static function apiDocAdditionalIndexAllowedAppends(): array
76
+
{
77
+
return [];
78
+
}
79
+
```
68
80
69
81
## apiDocAdditionalShowAllowedFields()
70
82
71
83
Use this method to specify additional fields that can be selected for the `show` endpoint. By default, this returns the same fields as `apiDocAdditionalIndexAllowedFields()`.
72
84
85
+
```php
86
+
public static function apiDocAdditionalShowAllowedFields(): array
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()`.
77
95
96
+
```php
97
+
public static function apiDocAdditionalShowAllowedAppends(): array
Use this method to specify additional fields that can be used for sorting results.
82
106
107
+
```php
108
+
public static function apiDocAdditionalAllowedSorts(): array
109
+
{
110
+
return [];
111
+
}
112
+
```
83
113
84
114
## apiDocAdditionalAllowedIncludes()
85
115
86
116
Use this method to specify additional relations that can be included in the response.
87
117
118
+
```php
119
+
public static function apiDocAdditionalAllowedIncludes(): array
120
+
{
121
+
return [];
122
+
}
123
+
```
88
124
89
125
## apiDocAdditionalAllowedFilters()
90
126
91
127
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.
92
128
129
+
```php
130
+
public static function apiDocAdditionalAllowedFilters(): array
131
+
{
132
+
return [];
133
+
}
134
+
```
135
+
93
136
## apiFieldsDescription()
94
137
95
138
Use this method to override the default fields description or append to it.
0 commit comments