From e7a950ffcb43ffa9e010ec59c71251a04ace6705 Mon Sep 17 00:00:00 2001 From: MartinOscar <40749467+rmartinoscar@users.noreply.github.com> Date: Wed, 4 Jun 2025 22:13:59 +0200 Subject: [PATCH] Replace `$allocation->toString()` with `$allocation->address` (#1431) --- app/Filament/Server/Resources/AllocationResource.php | 2 +- .../AllocationResource/Pages/ListAllocations.php | 2 +- .../Api/Client/Servers/NetworkAllocationController.php | 8 ++++---- app/Models/Allocation.php | 5 ----- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/app/Filament/Server/Resources/AllocationResource.php b/app/Filament/Server/Resources/AllocationResource.php index 9719cc975..1e4a03275 100644 --- a/app/Filament/Server/Resources/AllocationResource.php +++ b/app/Filament/Server/Resources/AllocationResource.php @@ -77,7 +77,7 @@ class AllocationResource extends Resource Activity::event('server:allocation.delete') ->subject($allocation) - ->property('allocation', $allocation->toString()) + ->property('allocation', $allocation->address) ->log(); }), ]); diff --git a/app/Filament/Server/Resources/AllocationResource/Pages/ListAllocations.php b/app/Filament/Server/Resources/AllocationResource/Pages/ListAllocations.php index ee9526cc3..ad32aed40 100644 --- a/app/Filament/Server/Resources/AllocationResource/Pages/ListAllocations.php +++ b/app/Filament/Server/Resources/AllocationResource/Pages/ListAllocations.php @@ -32,7 +32,7 @@ class ListAllocations extends ListRecords Activity::event('server:allocation.create') ->subject($allocation) - ->property('allocation', $allocation->toString()) + ->property('allocation', $allocation->address) ->log(); }), ]; diff --git a/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php b/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php index 55e8023ac..c287addb6 100644 --- a/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php +++ b/app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php @@ -62,7 +62,7 @@ class NetworkAllocationController extends ClientApiController if ($original !== $allocation->notes) { Activity::event('server:allocation.notes') ->subject($allocation) - ->property(['allocation' => $allocation->toString(), 'old' => $original, 'new' => $allocation->notes]) + ->property(['allocation' => $allocation->address, 'old' => $original, 'new' => $allocation->notes]) ->log(); } @@ -87,7 +87,7 @@ class NetworkAllocationController extends ClientApiController Activity::event('server:allocation.primary') ->subject($allocation) - ->property('allocation', $allocation->toString()) + ->property('allocation', $allocation->address) ->log(); return $this->fractal->item($allocation) @@ -114,7 +114,7 @@ class NetworkAllocationController extends ClientApiController Activity::event('server:allocation.create') ->subject($allocation) - ->property('allocation', $allocation->toString()) + ->property('allocation', $allocation->address) ->log(); return $this->fractal->item($allocation) @@ -148,7 +148,7 @@ class NetworkAllocationController extends ClientApiController Activity::event('server:allocation.delete') ->subject($allocation) - ->property('allocation', $allocation->toString()) + ->property('allocation', $allocation->address) ->log(); return new JsonResponse([], JsonResponse::HTTP_NO_CONTENT); diff --git a/app/Models/Allocation.php b/app/Models/Allocation.php index 39ae0ad60..bb642244f 100644 --- a/app/Models/Allocation.php +++ b/app/Models/Allocation.php @@ -121,11 +121,6 @@ class Allocation extends Model ); } - public function toString(): string - { - return $this->address; - } - /** * Gets information for the server associated with this allocation. */