*/ public function toArray(Request $request): array { return [ 'id' => $this->id, 'name' => $this->name, 'email' => $this->email, 'roles' => $this->whenLoaded('roles', fn () => $this->getRoleNames()), 'permissions' => $this->whenLoaded('roles', fn () => $this->getAllPermissions()->pluck('name')), 'email_verified_at' => $this->email_verified_at?->toISOString(), 'created_at' => $this->created_at?->toISOString(), 'updated_at' => $this->updated_at?->toISOString(), 'deleted_at' => $this->deleted_at?->toISOString(), ]; } }