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
* Implement API to many relations
• Added method to process belongToMany and morphToMany relationships.
* Added notes about relationship sync
* Apply fixes from StyleCI (#70)
Co-authored-by: Craig Smith <[email protected]>
Co-authored-by: Craig Smith <[email protected]>
Co-authored-by: Craig Smith <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+6
Original file line number
Diff line number
Diff line change
@@ -156,6 +156,12 @@ Simply add a `protected static $mapResources` to your `Resource` to define which
156
156
];
157
157
```
158
158
159
+
- You can automatically update and create related records for most types of relationships. Just include the related resource name in your POST or PUT request.
160
+
161
+
For `BelongsToMany` or `MorphToMany` relationships, you can choose the sync strategy. By default, this will take an *additive* strategy. That is to say, related records sent will be ADDED to any existing related records. On a request-by-request basis, you can opt for a *sync* strategy which will remove the pivot for any related records not listed in the request. Note the actual related record will not be removed, just the pivot entry.
162
+
163
+
To opt for the *sync* behavaiour, set `?sync[field]=true` in your request.
164
+
159
165
## Sorting
160
166
161
167
- Sorts can be passed as comma list aswell, ie `sort=age asc` or `sort=age asc,name desc,eyes` - generates sql of `sort age asc` and `sort age asc, name desc, eyes asc` respectively
0 commit comments