Total Complexity | 6 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | trait HasCompositePrimaryKey |
||
8 | { |
||
9 | /** |
||
10 | * @param Builder $query |
||
11 | * @return Builder |
||
12 | */ |
||
13 | protected function setKeysForSaveQuery($query) |
||
14 | { |
||
15 | $keys = $this->getKeyName(); |
||
|
|||
16 | if(!is_array($keys)){ |
||
17 | return parent::setKeysForSaveQuery($query); |
||
18 | } |
||
19 | |||
20 | foreach($keys as $keyName){ |
||
21 | $query->where($keyName, '=', $this->getKeyForSaveQuery($keyName)); |
||
22 | } |
||
23 | |||
24 | return $query; |
||
25 | } |
||
26 | |||
27 | /** |
||
28 | * @param null $keyName |
||
29 | * @return mixed |
||
30 | */ |
||
31 | protected function getKeyForSaveQuery($keyName = null) |
||
42 | } |
||
43 | } |