@@ -27,8 +27,9 @@ |
||
| 27 | 27 | |
| 28 | 28 | public function get() : mixed |
| 29 | 29 | { |
| 30 | - if(!$this->isChanged()) |
|
| 31 | - return null; |
|
| 30 | + if(!$this->isChanged()) { |
|
| 31 | + return null; |
|
| 32 | + } |
|
| 32 | 33 | |
| 33 | 34 | return $this->value; |
| 34 | 35 | } |
@@ -41,8 +41,7 @@ |
||
| 41 | 41 | { |
| 42 | 42 | $record->setValue($value); |
| 43 | 43 | $record->save(); |
| 44 | - } |
|
| 45 | - else |
|
| 44 | + } else |
|
| 46 | 45 | { |
| 47 | 46 | $factory = $this->getFactory(); |
| 48 | 47 | $record = $factory->createValue($type, $domainKey, $entityKey, $attributeKey, $value); |
@@ -48,8 +48,9 @@ |
||
| 48 | 48 | $query = AttributeModel::query() |
| 49 | 49 | ->where(_ATTR::DOMAIN_ID->column(), $domainKey); |
| 50 | 50 | |
| 51 | - if (!is_null($setKey)) |
|
| 52 | - $query->with(['pivot' => fn(Builder $q) => $q->where(_PIVOT::SET_ID->column(), $setKey)]); |
|
| 51 | + if (!is_null($setKey)) { |
|
| 52 | + $query->with(['pivot' => fn(Builder $q) => $q->where(_PIVOT::SET_ID->column(), $setKey)]); |
|
| 53 | + } |
|
| 53 | 54 | |
| 54 | 55 | return $query->get(); |
| 55 | 56 | } |
@@ -53,27 +53,22 @@ |
||
| 53 | 53 | if ($operator == QB_OPERATOR::IN) |
| 54 | 54 | { |
| 55 | 55 | return $query->whereIn($name, $value, $condition); |
| 56 | - } |
|
| 57 | - else if ($operator == QB_OPERATOR::NOT_IN) |
|
| 56 | + } else if ($operator == QB_OPERATOR::NOT_IN) |
|
| 58 | 57 | { |
| 59 | 58 | return $query->whereNotIn($name, $value, $condition); |
| 60 | - } |
|
| 61 | - else if($operator == QB_OPERATOR::BETWEEN) |
|
| 59 | + } else if($operator == QB_OPERATOR::BETWEEN) |
|
| 62 | 60 | { |
| 63 | 61 | return $query->whereBetween($name, $value, $condition); |
| 64 | - } |
|
| 65 | - else if($operator == QB_OPERATOR::NOT_BETWEEN) |
|
| 62 | + } else if($operator == QB_OPERATOR::NOT_BETWEEN) |
|
| 66 | 63 | { |
| 67 | 64 | return $query->whereNotBetween($name, $value, $condition); |
| 68 | 65 | } |
| 69 | - } |
|
| 70 | - else if($operator->isNull()) |
|
| 66 | + } else if($operator->isNull()) |
|
| 71 | 67 | { |
| 72 | 68 | if ($operator == QB_OPERATOR::IS_NULL) |
| 73 | 69 | { |
| 74 | 70 | return $query->whereNull($name, $condition); |
| 75 | - } |
|
| 76 | - else if($operator == QB_OPERATOR::IS_NOT_NULL) |
|
| 71 | + } else if($operator == QB_OPERATOR::IS_NOT_NULL) |
|
| 77 | 72 | { |
| 78 | 73 | return $query->whereNotNull($name, $condition); |
| 79 | 74 | } |
@@ -67,7 +67,9 @@ |
||
| 67 | 67 | |
| 68 | 68 | public function isColumn(string $column) : bool |
| 69 | 69 | { |
| 70 | - if(!$this->isColumns()) return false; |
|
| 70 | + if(!$this->isColumns()) { |
|
| 71 | + return false; |
|
| 72 | + } |
|
| 71 | 73 | return in_array($column, $this->getColumns()); |
| 72 | 74 | } |
| 73 | 75 | |
@@ -48,7 +48,9 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | public function setAttributeJoined(string $name): void |
| 50 | 50 | { |
| 51 | - if(!$this->isAttribute($name)) return; |
|
| 51 | + if(!$this->isAttribute($name)) { |
|
| 52 | + return; |
|
| 53 | + } |
|
| 52 | 54 | if(!$this->isAttributeJoined($name)) |
| 53 | 55 | { |
| 54 | 56 | $this->joins[] = $name; |
@@ -62,7 +64,9 @@ discard block |
||
| 62 | 64 | |
| 63 | 65 | public function setAttributeSelected(string $name): void |
| 64 | 66 | { |
| 65 | - if(!$this->isAttribute($name)) return; |
|
| 67 | + if(!$this->isAttribute($name)) { |
|
| 68 | + return; |
|
| 69 | + } |
|
| 66 | 70 | if(!$this->isAttributeJoined($name)) |
| 67 | 71 | { |
| 68 | 72 | $this->selected[] = $name; |
@@ -42,7 +42,9 @@ |
||
| 42 | 42 | |
| 43 | 43 | public static function isValid(string $type): bool |
| 44 | 44 | { |
| 45 | - if($type === self::MANUAL->value()) return false; |
|
| 45 | + if($type === self::MANUAL->value()) { |
|
| 46 | + return false; |
|
| 47 | + } |
|
| 46 | 48 | $cases = array_map(fn($case) => $case->value(), self::cases()); |
| 47 | 49 | return in_array($type, $cases); |
| 48 | 50 | } |
@@ -141,7 +141,9 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | foreach($valueSet->forNewEntities() as $value) |
| 143 | 143 | { |
| 144 | - if($value->isEmptyValue()) continue; |
|
| 144 | + if($value->isEmptyValue()) { |
|
| 145 | + continue; |
|
| 146 | + } |
|
| 145 | 147 | $value->setEntityKey($entities[$value->getLineIndex() - 1]->getKey()); |
| 146 | 148 | $bulkCreateSet->appendValue($value); |
| 147 | 149 | } |
@@ -165,10 +167,11 @@ discard block |
||
| 165 | 167 | $attribute = $attrSet->getAttribute($attributeValue->getAttributeName()); |
| 166 | 168 | $attributeKey = $attribute->getKey(); |
| 167 | 169 | $attributeType = $attribute->getTypeEnum(); |
| 168 | - if($value == '') |
|
| 169 | - $repository->destroy($domainKey,$entityKey,$attributeKey,$attributeType); |
|
| 170 | - else |
|
| 171 | - $repository->updateOrCreate($domainKey,$entityKey,$attributeKey,$attributeType,$value); |
|
| 170 | + if($value == '') { |
|
| 171 | + $repository->destroy($domainKey,$entityKey,$attributeKey,$attributeType); |
|
| 172 | + } else { |
|
| 173 | + $repository->updateOrCreate($domainKey,$entityKey,$attributeKey,$attributeType,$value); |
|
| 174 | + } |
|
| 172 | 175 | } |
| 173 | 176 | } |
| 174 | 177 | |