@@ -15,14 +15,32 @@ Eager load relationships.
15
15
await Model .include (' user' , ' category' )
16
16
```
17
17
18
+ #### Array
19
+
20
+ <alert type =" success " >Available in version >= v1.8.0</alert >
21
+
22
+ ``` js
23
+ await Model .include ([' user' , ' category' ])
24
+ ```
25
+
26
+ <alert type =" info " >` with ` is an alias of this method.</alert >
27
+
18
28
## ` append `
19
29
- Arguments: ` (...args) `
20
30
- Returns: ` self `
21
31
22
32
Append attributes.
23
33
24
34
``` js
25
- await Model .append (' likes' )
35
+ await Model .append (' likes' , ' shares' )
36
+ ```
37
+
38
+ #### Array
39
+
40
+ <alert type =" success " >Available in version >= v1.8.0</alert >
41
+
42
+ ``` js
43
+ await Model .append ([' likes' , ' shares' ])
26
44
```
27
45
28
46
## ` select `
@@ -31,12 +49,12 @@ await Model.append('likes')
31
49
32
50
Set the columns to be selected.
33
51
34
- ** Single entity: **
52
+ #### Single entity
35
53
``` js
36
54
await Model .select ([' title' , ' content' ])
37
55
```
38
56
39
- ** Related entities: **
57
+ #### Related entities
40
58
``` js
41
59
await Post .select ({
42
60
posts: [' title' , ' content' ],
@@ -54,6 +72,14 @@ Add a basic where clause to the query.
54
72
await Model .where (' status' , ' active' )
55
73
```
56
74
75
+ #### Nested
76
+
77
+ <alert type =" success " >Available in version >= v1.8.0</alert >
78
+
79
+ ``` js
80
+ await Model .where ([' user' , ' status' ], ' active' )
81
+ ```
82
+
57
83
## ` whereIn `
58
84
- Arguments: ` (field, array) `
59
85
- Returns: ` self `
@@ -64,6 +90,14 @@ Add a "where in" clause to the query.
64
90
await Model .whereIn (' id' , [1 , 2 , 3 ])
65
91
```
66
92
93
+ #### Nested
94
+
95
+ <alert type =" success " >Available in version >= v1.8.0</alert >
96
+
97
+ ``` js
98
+ await Model .whereIn ([' user' , ' id' ], [1 , 2 , 3 ])
99
+ ```
100
+
67
101
## ` orderBy `
68
102
- Arguments: ` (...args) `
69
103
- Returns: ` self `
@@ -74,6 +108,14 @@ Add an "order by" clause to the query.
74
108
await Model .orderBy (' -created_at' , ' category_id' )
75
109
```
76
110
111
+ #### Array
112
+
113
+ <alert type =" success " >Available in version >= v1.8.0</alert >
114
+
115
+ ``` js
116
+ await Model .orderBy ([' -created_at' , ' category_id' ])
117
+ ```
118
+
77
119
## ` page `
78
120
- Arguments: ` (value) `
79
121
- Returns: ` self `
@@ -160,6 +202,22 @@ Build custom endpoints.
160
202
</code-block >
161
203
</code-group >
162
204
205
+ ## ` config `
206
+ <alert type =" success " >Available in version >= v1.8.0</alert >
207
+
208
+ - Arguments: ` (config) `
209
+ - Returns: ` self `
210
+
211
+ Configuration of HTTP Instance.
212
+
213
+ ``` js
214
+ await Model .config ({
215
+ method: ' PATCH' ,
216
+ header: { /* ... */ },
217
+ data: { foo: ' bar' }
218
+ }).save ()
219
+ ```
220
+
163
221
## ` get `
164
222
- Returns: ` Collection | { data: Collection } `
165
223
@@ -169,6 +227,8 @@ Execute the query as a "select" statement.
169
227
await Model .get ()
170
228
```
171
229
230
+ <alert type =" info " >` all ` is an alias of this method.</alert >
231
+
172
232
## ` first `
173
233
- Returns: ` Model | { data: Model } `
174
234
@@ -193,15 +253,15 @@ await Model.find(1)
193
253
194
254
Execute the query as a "select" statement.
195
255
196
- These ` $ ` -prefixed convenience methods always return the requested content as [ ` JSON ` ] ( https://developer.mozilla.org/en-US/docs/Web/API/Body/json ) .
197
-
198
256
``` js
199
257
await Model .$get ()
200
258
```
201
259
202
- <alert type =" info " >These ` $ ` -prefixed convenience methods always return the requested content.
260
+ <alert type =" info " >These ` $ ` -prefixed convenience methods always return the requested content.
203
261
They handle and unwrap responses within "data".</alert >
204
262
263
+ <alert type =" info " >` $all ` is an alias of this method.</alert >
264
+
205
265
## ` $first `
206
266
- Returns: ` Model `
207
267
0 commit comments