| Total Complexity | 7 | 
| Total Lines | 49 | 
| Duplicated Lines | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php | ||
| 7 | trait HasCompositePrimaryKey | ||
| 8 | { | ||
| 9 | /** | ||
| 10 | * Get the value indicating whether the IDs are incrementing. | ||
| 11 | * | ||
| 12 | * @return bool | ||
| 13 | */ | ||
| 14 | public function getIncrementing(): bool | ||
| 15 |     { | ||
| 16 | return false; | ||
| 17 | } | ||
| 18 | |||
| 19 | /** | ||
| 20 | * Set the keys for a save update query. | ||
| 21 | * | ||
| 22 | * @param Builder $query | ||
| 23 | * @return Builder | ||
| 24 | */ | ||
| 25 | protected function setKeysForSaveQuery($query): Builder | ||
| 26 |     { | ||
| 27 | $keys = $this->getKeyName(); | ||
|  | |||
| 28 |         if (! is_array($keys)) { | ||
| 29 | return parent::setKeysForSaveQuery($query); | ||
| 30 | } | ||
| 31 | |||
| 32 |         foreach ($keys as $keyName) { | ||
| 33 | $query->where($keyName, '=', $this->getKeyForSaveQuery($keyName)); | ||
| 34 | } | ||
| 35 | |||
| 36 | return $query; | ||
| 37 | } | ||
| 38 | |||
| 39 | /** | ||
| 40 | * Get the primary key value for a save query. | ||
| 41 | * | ||
| 42 | * @param string|null $keyName | ||
| 43 | * @return mixed | ||
| 44 | */ | ||
| 45 | protected function getKeyForSaveQuery(string $keyName = null): mixed | ||
| 56 | } | ||
| 57 | } | ||
| 58 |