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
@@ -61,18 +64,21 @@ Thats it! Your api endpoint `/api/user` will now work. All the REST methods - `i
61
64
This package follows [Microsoft RestAPI Guidelines](https://github.com/Microsoft/api-guidelines/blob/master/Guidelines.md) - except the fields definition - which is inspired from Facebook Graph API.
62
65
63
66
### Parameters
64
-
You can modify the results you get from `index` and `show` methods using various paramters as follows:
67
+
68
+
You can modify the results you get from `index` and `show` methods using various parameters as follows:
65
69
66
70
***fields**: A comma separated list of fields you want to get in results, in following format:
Here, `id` and `name` are normal database columns, and comments is a **relation**. If no fields are specified, results contain list of fields in` $defaults` array. By default, this array only has `id` field. You can override it in your model with your own default fields list.
71
77
72
78
***filters**: A filter query with defined in [Microsoft RestAPI Guidelines - Filters](https://github.com/Microsoft/api-guidelines/blob/master/Guidelines.md#97-filtering). **Note:** for security reasons, filtering on all columns is disabled. You need to specify a list of columns in $filterable property in your model to allow the columns on which you want to allow filtering.
73
79
74
80
```
75
-
filters=status eq "active" or (status eq "suspended" and deleted_at eq null)
81
+
filters=status eq "active" or (status eq "suspended" and deleted_at eq null)
76
82
```
77
83
Apart from operators in the guidelines, one more operator - `lk` - is supported which corresponds to like query in MySQL.
78
84
@@ -89,9 +95,10 @@ Saving and updating works out of the box, including relations. But, the fields r
89
95
### Form request
90
96
91
97
If you use form requests for validation, simple store the request class's reference in the form request parameters in your controller:
98
+
92
99
```
93
-
$indexRequest = UserIndexRequest::class;
94
-
$storeRequest = UserStoreRequest::class;
100
+
$indexRequest = UserIndexRequest::class;
101
+
$storeRequest = UserStoreRequest::class;
95
102
```
96
103
97
104
### Modifying query
@@ -107,8 +114,9 @@ public function modifyIndex($query) {
107
114
### Relations endpoint
108
115
109
116
You can call relations endpoint to get only the relations. For example, to get a particular user's comments, you can call:
0 commit comments