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>
35 lines
1.2 KiB
PHP
35 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class UserDetailResource extends JsonResource
|
|
{
|
|
public function toArray(Request $request): array
|
|
{
|
|
$relation = $this->profileRelation();
|
|
$profile = $relation ? $this->{$relation} : null;
|
|
|
|
return [
|
|
'id' => $this->uuid,
|
|
'email' => $this->email,
|
|
'phone' => $this->phone,
|
|
'first_name' => $this->first_name,
|
|
'middle_name' => $this->middle_name,
|
|
'last_name' => $this->last_name,
|
|
'full_name' => $this->full_name,
|
|
'role' => $this->role,
|
|
'status' => $this->status,
|
|
'preferred_language' => $this->preferred_language,
|
|
'avatar_path' => $this->avatar_path,
|
|
'email_verified_at' => $this->email_verified_at?->toIso8601String(),
|
|
'phone_verified_at' => $this->phone_verified_at?->toIso8601String(),
|
|
'last_login_at' => $this->last_login_at?->toIso8601String(),
|
|
'created_at' => $this->created_at?->toIso8601String(),
|
|
'profile' => $profile?->toArray(),
|
|
];
|
|
}
|
|
}
|