feat: implement barangay and household management with associated tests

This commit is contained in:
Developer
2026-06-29 15:02:52 +08:00
parent 9ac2ea7bda
commit b85fc255cf
124 changed files with 2894 additions and 192 deletions

View File

@@ -17,7 +17,7 @@ class AdminUserController extends ApiController
{
$request->validate([
'role' => [
'nullable',
'nullable',
Rule::in([
User::ROLE_ADMIN,
User::ROLE_RESIDENT,
@@ -25,7 +25,7 @@ class AdminUserController extends ApiController
User::ROLE_HELPER,
User::ROLE_SCANNER,
User::ROLE_STORE_PARTNER,
])
]),
],
'status' => [
'nullable',
@@ -33,9 +33,10 @@ class AdminUserController extends ApiController
User::STATUS_ACTIVE,
User::STATUS_SUSPENDED,
User::STATUS_PENDING,
])
]),
],
'verification_status' => ['nullable', 'in:pending,approved,rejected'],
'without_household' => ['nullable', 'boolean'],
'q' => ['nullable', 'string', 'max:100'],
'per_page' => ['nullable', 'integer', 'min:1', 'max:500'],
]);
@@ -45,6 +46,7 @@ class AdminUserController extends ApiController
$users = User::query()
->when($request->filled('role'), fn ($q) => $q->where('role', $request->string('role')))
->when($request->filled('status'), fn ($q) => $q->where('status', $request->string('status')))
->when($request->boolean('without_household'), fn ($q) => $q->whereDoesntHave('headedHousehold'))
->when($request->filled('q'), function ($q) use ($request) {
$term = '%'.$request->string('q').'%';
$q->where(function ($qq) use ($term) {