<?php
 namespace App\Observers; use App\Models\IpPool; class IpPoolObserver { public function saving(IpPool $pool): void { if ($pool->is_default && $pool->server_id) { IpPool::where('server_id', $pool->server_id) ->where('id', '!=', $pool->id ?? 0) ->where('is_default', true) ->update(['is_default' => false]); } } } 