Add Livewire component to display and save user IP

Introduces ShowSavingIp Livewire component to fetch, display, and save the authenticated user's IP address. Integrates the component into the navigation layout and comments out the unused /ip-test route.
This commit is contained in:
Juan Felipe Duarte
2025-10-18 14:10:11 -05:00
parent 227b129613
commit aa67099449
4 changed files with 56 additions and 2 deletions
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace App\Http\Livewire;
use Livewire\Component;
use Illuminate\Support\Facades\Auth;
class ShowSavingIp extends Component
{
public $ip_address;
protected $listeners = ['setIpAddress'];
public function setIpAddress($ip)
{
$this->ip_address = $ip;
$user = Auth::user();
if ($user) {
$user->ip_address = $ip;
$user->save();
}
}
public function render()
{
return view('livewire.show-saving-ip');
}
}