| @@ 268-270 (lines=3) @@ | ||
| 265 | protected function wherePivot($innerKey, $outerKey) |
|
| 266 | { |
|
| 267 | $query = []; |
|
| 268 | if (!empty($this->definition[RecordEntity::MORPH_KEY])) { |
|
| 269 | $query[$this->definition[RecordEntity::MORPH_KEY]] = $this->parentRole(); |
|
| 270 | } |
|
| 271 | ||
| 272 | if (!empty($innerKey)) { |
|
| 273 | $query[$this->definition[RecordEntity::THOUGHT_INNER_KEY]] = $innerKey; |
|
| @@ 276-282 (lines=7) @@ | ||
| 273 | $query[$this->definition[RecordEntity::THOUGHT_INNER_KEY]] = $innerKey; |
|
| 274 | } |
|
| 275 | ||
| 276 | if (!empty($this->definition[RecordEntity::WHERE_PIVOT])) { |
|
| 277 | //Custom where pivot conditions |
|
| 278 | $query = $query + $this->mountAlias( |
|
| 279 | $this->definition[RecordEntity::PIVOT_TABLE], |
|
| 280 | $this->definition[RecordEntity::WHERE_PIVOT] |
|
| 281 | ); |
|
| 282 | } |
|
| 283 | ||
| 284 | if (!empty($outerKey)) { |
|
| 285 | $query[$this->definition[RecordEntity::THOUGHT_OUTER_KEY]] = is_array($outerKey) |
|
| @@ 353-355 (lines=3) @@ | ||
| 350 | $this->definition[RecordEntity::THOUGHT_OUTER_KEY] => $outerKey, |
|
| 351 | ]; |
|
| 352 | ||
| 353 | if (!empty($this->definition[RecordEntity::MORPH_KEY])) { |
|
| 354 | $data[$this->definition[RecordEntity::MORPH_KEY]] = $this->parentRole(); |
|
| 355 | } |
|
| 356 | ||
| 357 | return $data + $pivotData; |
|
| 358 | } |
|
| @@ 262-264 (lines=3) @@ | ||
| 259 | $this->definition[RecordEntity::THOUGHT_INNER_KEY] => $this->parent->getField($innerKey), |
|
| 260 | ]; |
|
| 261 | ||
| 262 | if ($wherePivot && !empty($this->definition[RecordEntity::WHERE_PIVOT])) { |
|
| 263 | $query = $query + $this->definition[RecordEntity::WHERE_PIVOT]; |
|
| 264 | } |
|
| 265 | ||
| 266 | return $this->pivotTable()->delete($query)->run(); |
|
| 267 | } |
|