kamilcraft-api/app/Http/Resources/CVResource.php

33 lines
848 B
PHP

<?php
declare(strict_types=1);
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class CVResource extends JsonResource
{
public static $wrap = null;
public function toArray($request): array
{
return [
'token' => $this->token,
'email' => $this->email,
'phoneNumber' => $this->phoneNumber,
'formattedPhoneNumber' => $this->formattedPhoneNumber,
'phone' => new PhoneResource($this->resource),
'locations' => $this->locations,
'mission' => $this->when(
!is_null($this->mission),
fn (): array => explode(PHP_EOL, $this->mission, 5)
),
'rodo' => $this->when(
!is_null($this->rodo),
$this->rodo
),
];
}
}