38 lines
1.1 KiB
PHP
38 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Integrations\Whmcs\Writers;
|
|
|
|
use App\Integrations\Whmcs\DTOs\ClientData;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class ClientWriter
|
|
{
|
|
/**
|
|
* Upsert into `customers` keyed by `uuid` (WHMCS already assigns a uuid per client).
|
|
*/
|
|
public function write(ClientData $data): void
|
|
{
|
|
DB::table('customers')->updateOrInsert(
|
|
['uuid' => $data->uuid],
|
|
[
|
|
'fullname' => $data->fullname,
|
|
'company' => $data->company,
|
|
'address' => $data->address,
|
|
'state' => $data->state,
|
|
'city' => $data->city,
|
|
'saler' => $data->saler,
|
|
'country' => $data->country,
|
|
'phone' => $data->phone,
|
|
'email' => $data->email,
|
|
'password' => $data->password,
|
|
'note' => $data->note,
|
|
'credit' => $data->credit,
|
|
'status' => $data->status,
|
|
'email_marketing' => $data->emailMarketing,
|
|
'created_at' => $data->createdAt,
|
|
'updated_at' => $data->updatedAt,
|
|
]
|
|
);
|
|
}
|
|
}
|