feat: bootstrap JOBcard CRM foundation
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
function validate_client(array $input): array
|
||||
{
|
||||
$name = trim((string)($input['name'] ?? ''));
|
||||
$status = (string)($input['status'] ?? 'active');
|
||||
$errors = [];
|
||||
if ($name === '') $errors['name'] = 'Client name is required.';
|
||||
if (mb_strlen($name) > 190) $errors['name'] = 'Client name must be 190 characters or fewer.';
|
||||
if (!in_array($status, ['active', 'inactive'], true)) $errors['status'] = 'Invalid client status.';
|
||||
return ['name' => $name, 'status' => $status, 'errors' => $errors];
|
||||
}
|
||||
Reference in New Issue
Block a user