39 lines
1.4 KiB
PHP
39 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Modules\Lead\App\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class LeadResource extends JsonResource
|
|
{
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'uuid' => $this->uuid,
|
|
'fullname' => $this->fullname,
|
|
'company' => $this->company,
|
|
'email' => $this->email,
|
|
'phone' => $this->phone,
|
|
'address' => $this->address,
|
|
'source' => $this->source,
|
|
'status' => $this->status,
|
|
'whmcs_client_id' => $this->whmcs_client_id,
|
|
'receives_invoice_emails' => $this->receives_invoice_emails,
|
|
'receives_domain_emails' => $this->receives_domain_emails,
|
|
'receives_support_emails' => $this->receives_support_emails,
|
|
'receives_product_emails' => $this->receives_product_emails,
|
|
'receives_general_emails' => $this->receives_general_emails,
|
|
'note' => $this->note,
|
|
'customer' => $this->whenLoaded('customer', fn () => $this->customer ? [
|
|
'id' => $this->customer->id,
|
|
'uuid' => $this->customer->uuid,
|
|
'fullname' => $this->customer->fullname,
|
|
'email' => $this->customer->email,
|
|
] : null),
|
|
'created_at' => $this->created_at,
|
|
'updated_at' => $this->updated_at,
|
|
];
|
|
}
|
|
}
|