Hello.
If I do a
$response = $this->wsService->checkUserCuil($dni);
dd($response->getActor());
return response()->json([
'status' => $response->getStatus(),
'actor' => $response->getActor(),
], 201);
I get:
App\Services\WebServices\WsER\Contracts\ActorResponse {#375 //
app/Http/Controllers/UserController.php:67
-PrsId: 447014
-Name: "xxxxxx"
-Last_name": "xxxxxx"
}
But If I make a json response like this:
$response = $this->wsService->CheckUserResponse($dni);
return response()->json([
'status' => $response->getStatus(),
'actor' => $response->getActor(),
], 201);
I get an empty data:
{"status":true,"actor":{}}
This is the CheckUserResponse.php
<?php
namespace App\Services\WebServices\WsEntreRios\Contracts;
class CheckUserResponse {
private readonly bool $status;
private readonly ActorResponse $actor;
public function __construct(bool $status,ActorResponse $actor) {
$this->status = $status;
$this->actor = $actor;
}
public function getStatus(): bool {
return $this->status;
}
public function getActor(): ActorResponse {
return $this->actor;
}
}
This is the ActorResponse file
<?php
namespace App\Services\WebServices\WsER\Contracts;
class ActorResponse
{
private int $PrsId;
private string $name;
private string $last_name;
public function __construct(array $payload)
{
$this->PrsId = $payload["PRS_ID"];
$this->name = $payload["NAME"];
$this->last_name = $payload["LAST_NAME"];
}
public function getPrsId(): int {
return $this->PrsId;
}
public function getLastName(): string {
return $this->lasta_name;
}
public function getNames(): string {
return $this->name;
}
public function getFullName(): string
{
return $this->last_name . ", " . $this->name;
}
public function getEntId(): int {
return $this->EntId;
}
}