| @@ 17-24 (lines=8) @@ | ||
| 14 | */ |
|
| 15 | trait HasEnums |
|
| 16 | { |
|
| 17 | public function setAttribute($key, $value) |
|
| 18 | { |
|
| 19 | if (! $this->isEnumAttribute($key) || $this->isNullableEnum($key, $value)) { |
|
| 20 | return parent::setAttribute($key, $value); |
|
| 21 | } |
|
| 22 | ||
| 23 | return $this->setEnumAttribute($key, $value); |
|
| 24 | } |
|
| 25 | ||
| 26 | public function getAttribute($key) |
|
| 27 | { |
|
| @@ 26-35 (lines=10) @@ | ||
| 23 | return $this->setEnumAttribute($key, $value); |
|
| 24 | } |
|
| 25 | ||
| 26 | public function getAttribute($key) |
|
| 27 | { |
|
| 28 | $value = parent::getAttribute($key); |
|
| 29 | ||
| 30 | if (! $this->isEnumAttribute($key) || $this->isNullableEnum($key, $value)) { |
|
| 31 | return $value; |
|
| 32 | } |
|
| 33 | ||
| 34 | return $this->getEnumAttribute($key, $value); |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * @param \Illuminate\Database\Eloquent\Builder $builder |
|