update
This commit is contained in:
parent
98e679268a
commit
287fd618c4
2 changed files with 22 additions and 15 deletions
|
@ -3,6 +3,7 @@
|
|||
namespace App\Filament\Resources\PhyreServerResource\Pages;
|
||||
|
||||
use App\Filament\Resources\PhyreServerResource;
|
||||
use App\Models\PhyreServer;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
|
@ -13,6 +14,14 @@ class ListPhyreServers extends ListRecords
|
|||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\Action::make('Sync Resources')->action(function() {
|
||||
$findPhyreServers = PhyreServer::all();
|
||||
if ($findPhyreServers->count() > 0) {
|
||||
foreach ($findPhyreServers as $phyreServer) {
|
||||
$phyreServer->syncResources();
|
||||
}
|
||||
}
|
||||
}),
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
|
|
|
@ -62,22 +62,20 @@ class PhyreServer extends Model
|
|||
->where('phyre_server_id', $this->id)
|
||||
->first();
|
||||
if (!$findCustomer) {
|
||||
|
||||
$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->company = $externalCustomer['company'];
|
||||
$customer->saveQuietly();
|
||||
|
||||
$findCustomer = new Customer();
|
||||
$findCustomer->phyre_server_id = $this->id;
|
||||
$findCustomer->external_id = $externalCustomer['id'];
|
||||
}
|
||||
$findCustomer->name = $externalCustomer['name'];
|
||||
$findCustomer->email = $externalCustomer['email'];
|
||||
$findCustomer->phone = $externalCustomer['phone'];
|
||||
$findCustomer->address = $externalCustomer['address'];
|
||||
$findCustomer->city = $externalCustomer['city'];
|
||||
$findCustomer->state = $externalCustomer['state'];
|
||||
$findCustomer->zip = $externalCustomer['zip'];
|
||||
$findCustomer->country = $externalCustomer['country'];
|
||||
$findCustomer->company = $externalCustomer['company'];
|
||||
$findCustomer->saveQuietly();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue