21 lines
559 B
PHP
21 lines
559 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Rules;
|
||
|
|
||
|
use Closure;
|
||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||
|
|
||
|
class StructuralObjectClass implements ValidationRule
|
||
|
{
|
||
|
/**
|
||
|
* Run the validation rule.
|
||
|
*
|
||
|
* @param \Closure(string, ?string=): \Illuminate\Translation\PotentiallyTranslatedString $fail
|
||
|
*/
|
||
|
public function validate(string $attribute,mixed $value,Closure $fail): void
|
||
|
{
|
||
|
if (! config('server')->schema('objectclasses',$value)->isStructural())
|
||
|
$fail(sprintf('The object class %s is not a StructuralObject class.',$value));
|
||
|
}
|
||
|
}
|