kamilcraft-api/app/Http/Resources/FullCVResource.php
2023-08-01 18:13:45 +02:00

32 lines
944 B
PHP

<?php
declare(strict_types=1);
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class FullCVResource extends JsonResource
{
public static $wrap = null;
public function toArray($request = null): array
{
return [
'id' => $this->id,
'token' => $this->token,
'email' => $this->email,
'recipient' => $this->recipient,
'phone' => new PhoneResource($this->resource),
'locations' => $this->locations,
'views' => $this->resource->info()->select('id')->get()->count(),
'registeredViews' => $this->views,
'mission' => explode(PHP_EOL, $this->mission ?? '', 5),
'rodo' => $this->rodo,
'position' => $this->position,
'created' => $this->created_at->format('d-m-Y H:i:s'),
'updated' => $this->updated_at->format('d-m-Y H:i:s'),
];
}
}