| @@ 116-123 (lines=8) @@ | ||
| 113 | * @param array $attributes |
|
| 114 | * @return void |
|
| 115 | */ |
|
| 116 | BelongsToMany::macro('attachIgnore', function ($id, array $attributes = [], $touch = true) { |
|
| 117 | $this->newPivotStatement()->insertIgnore($this->formatAttachRecords( |
|
| 118 | $this->parseIds($id), $attributes |
|
| 119 | )); |
|
| 120 | if ($touch) { |
|
| 121 | $this->touchIfTouching(); |
|
| 122 | } |
|
| 123 | }); |
|
| 124 | ||
| 125 | /** |
|
| 126 | * Attach models to the parent updating existing associations. |
|
| @@ 132-140 (lines=9) @@ | ||
| 129 | * @param array $attributes |
|
| 130 | * @return void |
|
| 131 | */ |
|
| 132 | BelongsToMany::macro('attachOnDuplicateKey', function ($id, array $attributes = [], $touch = true) { |
|
| 133 | $this->newPivotStatement()->insertOnDuplicateKey($this->formatAttachRecords( |
|
| 134 | $this->parseIds($id), $attributes |
|
| 135 | )); |
|
| 136 | ||
| 137 | if ($touch) { |
|
| 138 | $this->touchIfTouching(); |
|
| 139 | } |
|
| 140 | }); |
|
| 141 | } |
|
| 142 | } |
|