| @@ 157-161 (lines=5) @@ | ||
| 154 | */ |
|
| 155 | public function getAttribute($key) |
|
| 156 | { |
|
| 157 | if (str_contains($key, ':')) { |
|
| 158 | list($key, $locale) = explode(':', $key); |
|
| 159 | } else { |
|
| 160 | $locale = $this->locale(); |
|
| 161 | } |
|
| 162 | ||
| 163 | if ($this->isTranslationAttribute($key)) { |
|
| 164 | if ($this->getTranslation($locale) === null) { |
|
| @@ 189-193 (lines=5) @@ | ||
| 186 | */ |
|
| 187 | public function setAttribute($key, $value) |
|
| 188 | { |
|
| 189 | if (str_contains($key, ':')) { |
|
| 190 | list($key, $locale) = explode(':', $key); |
|
| 191 | } else { |
|
| 192 | $locale = $this->locale(); |
|
| 193 | } |
|
| 194 | ||
| 195 | if ($this->isTranslationAttribute($key)) { |
|
| 196 | $this->getTranslationOrNew($locale)->$key = $value; |
|