-
app/Models/Allocation.php
Open in GitHubuse Illuminate\Database\Eloquent\Casts\Attribute; class Allocation extends Model { // ... protected function address(): Attribute { return Attribute::make( get: fn () => (is_ipv6($this->alias) ? "[$this->alias]" : $this->alias) . ":$this->port", ); } // ... }
-
app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php
Open in GitHubuse App\Models\Server; use App\Models\Allocation; use App\Http\Requests\Api\Client\Servers\Network\SetPrimaryAllocationRequest; use Dedoc\Scramble\Attributes\Group; #[Group('Server - Allocation')] class NetworkAllocationController extends ClientApiController { // ... public function setPrimary(SetPrimaryAllocationRequest $request, Server $server, Allocation $allocation): array { // ... Activity::event('server:allocation.primary') ->subject($allocation) ->property('allocation', $allocation->address) ->log(); // ... } // ... }