koel/app/Rules/CustomizableUserPreference.php
2024-07-06 17:45:04 +02: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.');
}
}
}