diff --git a/app/Http/Livewire/ShowIpTest.php b/app/Http/Livewire/ShowIpTest.php index 7e621fd..ebf56ea 100644 --- a/app/Http/Livewire/ShowIpTest.php +++ b/app/Http/Livewire/ShowIpTest.php @@ -7,10 +7,23 @@ 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 function render() { - dd($ip = Request::ip()); - return view('livewire.show-ip-test'); } } diff --git a/resources/views/livewire/show-ip-test.blade.php b/resources/views/livewire/show-ip-test.blade.php index db86de0..0ef3005 100644 --- a/resources/views/livewire/show-ip-test.blade.php +++ b/resources/views/livewire/show-ip-test.blade.php @@ -1,3 +1,33 @@ -
- {{-- Close your eyes. Count to one. That is how long forever feels. --}} +
+
+

IPs del Usuario

+ +
+

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

+

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

+
+
+ +