Update PhyreServer.php

This commit is contained in:
Bozhidar Slaveykov 2024-04-06 20:47:55 +03:00
parent 3594ec3301
commit 62d3fdb76c

View file

@ -6,7 +6,6 @@ use App\ApiSDK\PhyreApiSDK;
use App\Events\ModelPhyreServerCreated;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class PhyreServer extends Model
{
@ -64,19 +63,18 @@ class PhyreServer extends Model
->first();
if (!$findCustomer) {
// Use db table to prevent model events from firing
$customer = DB::table('customers')->insert([
'phyre_server_id' => $this->id,
'external_id' => $externalCustomer['id'],
'name' => $externalCustomer['name'],
'email' => $externalCustomer['email'],
'phone' => $externalCustomer['phone'],
'address' => $externalCustomer['address'],
'city' => $externalCustomer['city'],
'state' => $externalCustomer['state'],
'zip' => $externalCustomer['zip'],
'country' => $externalCustomer['country'],
]);
$customer = new Customer();
$customer->phyre_server_id = $this->id;
$customer->external_id = $externalCustomer['id'];
$customer->name = $externalCustomer['name'];
$customer->email = $externalCustomer['email'];
$customer->phone = $externalCustomer['phone'];
$customer->address = $externalCustomer['address'];
$customer->city = $externalCustomer['city'];
$customer->state = $externalCustomer['state'];
$customer->zip = $externalCustomer['zip'];
$customer->country = $externalCustomer['country'];
$customer->saveQuietly();
}
}