koel/app/Rules/CustomizableUserPreference.php

18 lines
418 B
PHP
Raw Normal View History

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