feat(backend): complete Modules 2 + 3 (geo + user management)
Module 2 — Geographic Data: PSGC tables (regions/provinces/cities/ barangays) with native geometry(polygon|point, 4326) columns; cascading dropdown endpoints; ST_Contains-based GPS resolution; service-area CRUD with barangay attach/detach; SamplePsgcSeeder + psgc:import command. Module 3 — User Management: 5 role-specific profile tables (driver/ helper/scanner/store_partner with verification_status + rejection reason); profile auto-created on register; admin user CRUD with filters/pagination, suspend/activate, profile approve/reject; self-service /me + /me/profile with role-aware validation that blocks self-approval and resets rejected profiles to pending on resubmit. 69 feature tests passing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
40
app/Http/Requests/Admin/UpdateUserRequest.php
Normal file
40
app/Http/Requests/Admin/UpdateUserRequest.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UpdateUserRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
$userId = $this->route('user')?->id;
|
||||
|
||||
return [
|
||||
'first_name' => ['sometimes', 'required', 'string', 'max:100'],
|
||||
'middle_name' => ['sometimes', 'nullable', 'string', 'max:100'],
|
||||
'last_name' => ['sometimes', 'required', 'string', 'max:100'],
|
||||
'email' => [
|
||||
'sometimes', 'required', 'email', 'max:191',
|
||||
Rule::unique('users', 'email')->whereNull('deleted_at')->ignore($userId),
|
||||
],
|
||||
'phone' => [
|
||||
'sometimes', 'required', 'string', 'regex:/^\+?[0-9]{10,15}$/',
|
||||
Rule::unique('users', 'phone')->whereNull('deleted_at')->ignore($userId),
|
||||
],
|
||||
'preferred_language' => ['sometimes', 'string', 'in:en,tl,ceb'],
|
||||
'status' => ['sometimes', Rule::in([
|
||||
User::STATUS_ACTIVE,
|
||||
User::STATUS_SUSPENDED,
|
||||
User::STATUS_PENDING,
|
||||
])],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user