|
@@ -35,15 +35,23 @@ class UserResource extends JsonResource
|
|
|
'sector_id' => $this->sector_id,
|
|
'sector_id' => $this->sector_id,
|
|
|
'sector' => $this->whenLoaded('sector', fn() => ['id' => $this->sector->id, 'name' => $this->sector->name]),
|
|
'sector' => $this->whenLoaded('sector', fn() => ['id' => $this->sector->id, 'name' => $this->sector->name]),
|
|
|
'photo_url' => $this->photo_path
|
|
'photo_url' => $this->photo_path
|
|
|
- ? Storage::disk('s3')->temporaryUrl($this->photo_path, now()->addHours(24))
|
|
|
|
|
- : null,
|
|
|
|
|
|
|
+ ? Storage::disk('s3')->temporaryUrl($this->photo_path, now()->addHours(24))
|
|
|
|
|
+ : null,
|
|
|
|
|
+
|
|
|
|
|
+ 'dependents' => $this->dependents->map(fn($dependent) => [
|
|
|
|
|
+ 'id' => $dependent->id,
|
|
|
|
|
+ 'name' => $dependent->name,
|
|
|
|
|
+ 'kinship' => $dependent->kinship,
|
|
|
|
|
+ 'status' => $dependent->status,
|
|
|
|
|
+ 'expiry_date' => $this->expiry_date?->format('d/m/Y'),
|
|
|
|
|
+ ]),
|
|
|
'first_access_completed_at' => $this->first_access_completed_at?->format('Y-m-d H:i:s'),
|
|
'first_access_completed_at' => $this->first_access_completed_at?->format('Y-m-d H:i:s'),
|
|
|
'terms_accepted_at' => $this->terms_accepted_at?->format('Y-m-d H:i:s'),
|
|
'terms_accepted_at' => $this->terms_accepted_at?->format('Y-m-d H:i:s'),
|
|
|
'on_leave_at' => $this->on_leave_at?->format('Y-m-d H:i:s'),
|
|
'on_leave_at' => $this->on_leave_at?->format('Y-m-d H:i:s'),
|
|
|
'on_leave_by_user_id' => $this->on_leave_by_user_id,
|
|
'on_leave_by_user_id' => $this->on_leave_by_user_id,
|
|
|
'first_access_at' => $this->access_logs_min_accessed_at
|
|
'first_access_at' => $this->access_logs_min_accessed_at
|
|
|
- ? Carbon::parse($this->access_logs_min_accessed_at)->format('Y-m-d H:i:s')
|
|
|
|
|
- : null,
|
|
|
|
|
|
|
+ ? Carbon::parse($this->access_logs_min_accessed_at)->format('Y-m-d H:i:s')
|
|
|
|
|
+ : null,
|
|
|
'unread_notifications_count' => (int) ($this->unread_notifications_count ?? 0),
|
|
'unread_notifications_count' => (int) ($this->unread_notifications_count ?? 0),
|
|
|
'created_at' => Carbon::parse($this->created_at)->format('Y-m-d H:i:s'),
|
|
'created_at' => Carbon::parse($this->created_at)->format('Y-m-d H:i:s'),
|
|
|
'updated_at' => Carbon::parse($this->updated_at)->format('Y-m-d H:i:s'),
|
|
'updated_at' => Carbon::parse($this->updated_at)->format('Y-m-d H:i:s'),
|