add test batches

This commit is contained in:
root
2026-06-08 23:45:55 -04:00
parent c792b8be05
commit 8d4d610b82
1480 changed files with 22587 additions and 10762 deletions
+11 -11
View File
@@ -12,7 +12,9 @@ use Illuminate\Support\Facades\Validator;
class UserManagementService
{
public function __construct(private UserEventService $eventService) {}
public function __construct(private UserEventService $eventService)
{
}
public function create(array $payload, ?int $actorId = null): array
{
@@ -43,7 +45,7 @@ class UserManagementService
public function update(int $userId, array $payload): array
{
$user = User::query()->find($userId);
if (! $user) {
if (!$user) {
return ['ok' => false, 'message' => 'User not found.'];
}
@@ -65,7 +67,7 @@ class UserManagementService
public function delete(int $userId): array
{
$user = User::query()->find($userId);
if (! $user) {
if (!$user) {
return ['ok' => false, 'message' => 'User not found.'];
}
@@ -85,11 +87,11 @@ class UserManagementService
{
$actorId = $actorId ?? (auth()->id() ?? null);
if (! User::query()->whereKey($userId)->exists()) {
if (!User::query()->whereKey($userId)->exists()) {
return false;
}
if (! Role::query()->whereKey($roleId)->exists()) {
if (!Role::query()->whereKey($roleId)->exists()) {
return false;
}
@@ -131,10 +133,10 @@ class UserManagementService
'accept_school_policy' => ['required'],
];
$isParent = ! empty($data['is_parent']);
$noSecondParent = ! empty($data['no_second_parent_info']);
$isParent = !empty($data['is_parent']);
$noSecondParent = !empty($data['no_second_parent_info']);
if ($isParent && ! $noSecondParent) {
if ($isParent && !$noSecondParent) {
$rules += [
'second_firstname' => ['required', 'regex:/^[a-zA-Z\\s\\-]+$/', 'min:2', 'max:30'],
'second_lastname' => ['required', 'regex:/^[a-zA-Z\\s\\-]+$/', 'min:2', 'max:30'],
@@ -213,7 +215,7 @@ class UserManagementService
];
foreach ($map as $field) {
if (! array_key_exists($field, $payload)) {
if (!array_key_exists($field, $payload)) {
continue;
}
@@ -263,7 +265,6 @@ class UserManagementService
if ($value === 'female') {
return 'Female';
}
return null;
}
@@ -273,7 +274,6 @@ class UserManagementService
if ($value === '') {
return '';
}
return ucfirst($value);
}