| @@ 5-16 (lines=12) @@ | ||
| 2 | ||
| 3 | namespace Spatie\Enum\Laravel\Rules; |
|
| 4 | ||
| 5 | class EnumName extends Enum |
|
| 6 | { |
|
| 7 | protected $rule = 'enum_name'; |
|
| 8 | ||
| 9 | public function passes($attribute, $value): bool |
|
| 10 | { |
|
| 11 | $this->attribute = $attribute; |
|
| 12 | $this->value = $value; |
|
| 13 | ||
| 14 | return is_string($value) && $this->enum::isValidName($value); |
|
| 15 | } |
|
| 16 | } |
|
| 17 | ||
| @@ 5-16 (lines=12) @@ | ||
| 2 | ||
| 3 | namespace Spatie\Enum\Laravel\Rules; |
|
| 4 | ||
| 5 | class EnumValue extends Enum |
|
| 6 | { |
|
| 7 | protected $rule = 'enum_value'; |
|
| 8 | ||
| 9 | public function passes($attribute, $value): bool |
|
| 10 | { |
|
| 11 | $this->attribute = $attribute; |
|
| 12 | $this->value = $value; |
|
| 13 | ||
| 14 | return is_string($value) && $this->enum::isValidValue($value); |
|
| 15 | } |
|
| 16 | } |
|
| 17 | ||