Files
sirpremiumv2/app/Http/Livewire/ShowIpTest.php
T
Juan Felipe Duarte 013061c1d6 Show public and local IP addresses in Livewire view
Added properties and event listener to ShowIpTest component to display both public IP (from Laravel) and local IP (from JavaScript). Updated Blade view to show both IPs and included a script to detect local IP using WebRTC and dispatch it to Livewire.
2025-10-17 16:24:46 -05:00

30 lines
507 B
PHP

<?php
namespace App\Http\Livewire;
use Livewire\Component;
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()
{
return view('livewire.show-ip-test');
}
}