koel/app/Rules/CustomizableUserPreference.php
2024-05-31 13:03:47 +08:00

17 lines
418 B
PHP

<?php
namespace App\Rules;
use App\Values\UserPreferences;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
class CustomizableUserPreference implements ValidationRule
{
public function validate(string $attribute, mixed $value, Closure $fail): void
{
if (!UserPreferences::customizable($value)) {
$fail('Invalid or uncustomizable user preference key.');
}
}
}