From 4276f1da4e373182b8042ba1c1104b4dff65cafc Mon Sep 17 00:00:00 2001 From: Juan Felipe Duarte <70235683+DuarteJFelipe@users.noreply.github.com> Date: Sat, 18 Oct 2025 10:28:30 -0500 Subject: [PATCH] Refactor IP display logic in ShowIpTest component Simplifies the Livewire component by removing public and local IP properties and related listeners. Updates the Blade view to fetch and display the user's public IP using ipify API, removing previous local IP detection logic. --- app/Http/Livewire/ShowIpTest.php | 15 +-------- .../views/livewire/show-ip-test.blade.php | 33 +++---------------- 2 files changed, 5 insertions(+), 43 deletions(-) diff --git a/app/Http/Livewire/ShowIpTest.php b/app/Http/Livewire/ShowIpTest.php index ebf56ea..7603265 100644 --- a/app/Http/Livewire/ShowIpTest.php +++ b/app/Http/Livewire/ShowIpTest.php @@ -7,20 +7,7 @@ use Illuminate\Support\Facades\Request; class ShowIpTest extends Component { - public $public_ip; - public $local_ip; - - protected $listeners = ['setLocalIP' => 'setLocalIP']; - - public function mount() - { - $this->public_ip = Request::ip(); - } - - public function setLocalIP($data) - { - $this->local_ip = $data['ip']; - } + public string $ipId = ''; public function render() { diff --git a/resources/views/livewire/show-ip-test.blade.php b/resources/views/livewire/show-ip-test.blade.php index 0ef3005..6d82106 100644 --- a/resources/views/livewire/show-ip-test.blade.php +++ b/resources/views/livewire/show-ip-test.blade.php @@ -1,33 +1,8 @@
-
-

IPs del Usuario

- -
-

IP pública (Laravel): {{ $public_ip }}

-

IP local (JavaScript): {{ $local_ip ?? 'Detectando...' }}

-
+
+ +

Tu IP es:

- +