36 lines
1 KiB
PHP
36 lines
1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class CompanyResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'legacy' => [
|
|
'portal' => $this->legacy_portal,
|
|
'id' => $this->legacy_id,
|
|
],
|
|
'portal' => $this->portal?->value,
|
|
'type' => $this->type?->value,
|
|
'name' => $this->name,
|
|
'slug' => $this->slug,
|
|
'email' => $this->email,
|
|
'website' => $this->website,
|
|
'phone' => $this->phone,
|
|
'country_code' => $this->country_code,
|
|
'is_active' => $this->is_active,
|
|
'created_at' => $this->created_at?->toIso8601String(),
|
|
'updated_at' => $this->updated_at?->toIso8601String(),
|
|
];
|
|
}
|
|
}
|