TenantAtlas/apps/platform/app/Rules/SkipOrUuidRule.php
ahmido 3bbea1bd00 feat: productize restore wizard preview safety gates and process flow (#399)
## Summary
- productize the restore wizard preview safety gates and process-flow guidance for Spec 332
- add the restore create presenter plus new process-flow, proof, scope, and safety partials
- extend restore wizard feature, smoke, screenshot, and presenter coverage
- include the Spec 332 artifacts for spec, plan, and tasks

## Notes
- branch head was already pushed before PR creation
- working tree was clean when this PR was opened

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #399
2026-05-26 00:08:25 +00:00

40 lines
811 B
PHP

<?php
namespace App\Rules;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Support\Str;
class SkipOrUuidRule implements ValidationRule
{
public function __construct(public bool $allowSkip = true) {}
public function validate(string $attribute, mixed $value, Closure $fail): void
{
$message = 'Enter a valid group object ID (GUID), or use Skip assignment.';
if (! is_string($value)) {
$fail($message);
return;
}
$value = trim($value);
if ($value === '') {
$fail($message);
return;
}
if ($this->allowSkip && strtoupper($value) === 'SKIP') {
return;
}
if (! Str::isUuid($value)) {
$fail($message);
}
}
}