Skip to content

Commit a33d32d

Browse files
Missing information to toggle with intermediate table values (laravel#8266)
* Missing information to toggle with intermediate table values * Update eloquent-relationships.md * Update eloquent-relationships.md Co-authored-by: Taylor Otwell <[email protected]>
1 parent d2a4f13 commit a33d32d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

eloquent-relationships.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1929,6 +1929,13 @@ The many-to-many relationship also provides a `toggle` method which "toggles" th
19291929

19301930
$user->roles()->toggle([1, 2, 3]);
19311931

1932+
You may also pass additional intermediate table values with the IDs:
1933+
1934+
$user->roles()->toggle([
1935+
1 => ['expires' => true],
1936+
2 => ['expires' => true],
1937+
]);
1938+
19321939
<a name="updating-a-record-on-the-intermediate-table"></a>
19331940
#### Updating A Record On The Intermediate Table
19341941

0 commit comments

Comments
 (0)