@@ -56,21 +56,21 @@ discard block |
||
56 | 56 | * A custom key other than the column key is required because the trait is initialized before |
57 | 57 | * the original attributes of the model are filled in. |
58 | 58 | */ |
59 | - return new DynamicAttributes((array) $value); |
|
59 | + return new DynamicAttributes((array)$value); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | public function getAttribute($key) |
63 | 63 | { |
64 | 64 | // Fetching a native models' attribute has precedence over a dynamic attribute. |
65 | - if (array_key_exists($key, $this->attributes)){ |
|
65 | + if (array_key_exists($key, $this->attributes)) { |
|
66 | 66 | return parent::getAttribute($key); |
67 | 67 | } |
68 | 68 | |
69 | 69 | $locale = app()->getLocale(); |
70 | 70 | |
71 | 71 | // If the dynamic attributes contain a localized value, this has preference over any non-localized. |
72 | - foreach(["{$locale}.$key", $key] as $k){ |
|
73 | - if($this->dynamicAttributesInstance()->has($k)){ |
|
72 | + foreach (["{$locale}.$key", $key] as $k) { |
|
73 | + if ($this->dynamicAttributesInstance()->has($k)) { |
|
74 | 74 | return $this->dynamic($k); |
75 | 75 | } |
76 | 76 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | public function setAttribute($key, $value) |
82 | 82 | { |
83 | - if ($this->shouldBeSetAsDynamicAttribute($key)){ |
|
83 | + if ($this->shouldBeSetAsDynamicAttribute($key)) { |
|
84 | 84 | return $this->dynamicAttributesInstance()->set($key, $value); |
85 | 85 | } |
86 | 86 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | protected function shouldBeSetAsDynamicAttribute($key): bool |
91 | 91 | { |
92 | - if(array_key_exists($key, $this->attributes) || !array_key_exists($this->getDynamicAttributesKey(), $this->attributes)) { |
|
92 | + if (array_key_exists($key, $this->attributes) || !array_key_exists($this->getDynamicAttributesKey(), $this->attributes)) { |
|
93 | 93 | return false; |
94 | 94 | } |
95 | 95 |