2023-07-21 14:53:44 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
|
|
|
|
|
|
class ContactResource extends JsonResource
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Transform the resource into an array.
|
|
|
|
|
*
|
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
|
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
|
|
|
|
* @phpcs:disable Squiz.Commenting.FunctionComment.TypeHintMissing
|
|
|
|
|
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
|
|
|
|
*/
|
|
|
|
|
public function toArray($request)
|
|
|
|
|
{
|
|
|
|
|
//phpcs:enable
|
2023-08-28 19:08:23 +02:00
|
|
|
/** @var \App\Models\Contact */
|
|
|
|
|
$contact = $this;
|
2023-07-21 14:53:44 +02:00
|
|
|
return [
|
2023-08-28 19:08:23 +02:00
|
|
|
'id' => $contact->id,
|
2023-08-29 17:10:16 +02:00
|
|
|
'lastname' => $contact->lastname,
|
2023-08-28 19:08:23 +02:00
|
|
|
'firstname' => $contact->firstname,
|
|
|
|
|
'email' => $contact->email,
|
|
|
|
|
'phone' => $contact->phone,
|
|
|
|
|
'data' => $contact->data,
|
|
|
|
|
'notes' => $contact->notes,
|
|
|
|
|
'visits' => $contact->visits,
|
2023-09-01 16:50:18 +02:00
|
|
|
'timestamp' => $contact->timestamp->toISOString(),
|
2023-08-28 19:08:23 +02:00
|
|
|
'app_user_id' => $contact->app_user_id,
|
2023-09-04 09:11:44 +02:00
|
|
|
'send_to_app_user_id' => null,
|
2023-08-28 19:08:23 +02:00
|
|
|
'created_at' => $contact->created_at,
|
|
|
|
|
'updated_at' => $contact->updated_at,
|
2023-07-21 14:53:44 +02:00
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|