From aa67099449869888e426e069c3be1b841777226f Mon Sep 17 00:00:00 2001 From: Juan Felipe Duarte <70235683+DuarteJFelipe@users.noreply.github.com> Date: Sat, 18 Oct 2025 14:10:11 -0500 Subject: [PATCH] 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. --- app/Http/Livewire/ShowSavingIp.php | 29 +++++++++++++++++++ resources/views/layouts/navigation.blade.php | 4 ++- .../views/livewire/show-saving-ip.blade.php | 23 +++++++++++++++ routes/web.php | 2 +- 4 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 app/Http/Livewire/ShowSavingIp.php create mode 100644 resources/views/livewire/show-saving-ip.blade.php diff --git a/app/Http/Livewire/ShowSavingIp.php b/app/Http/Livewire/ShowSavingIp.php new file mode 100644 index 0000000..4729e2a --- /dev/null +++ b/app/Http/Livewire/ShowSavingIp.php @@ -0,0 +1,29 @@ +ip_address = $ip; + + $user = Auth::user(); + if ($user) { + $user->ip_address = $ip; + $user->save(); + } + } + + public function render() + { + return view('livewire.show-saving-ip'); + } +} diff --git a/resources/views/layouts/navigation.blade.php b/resources/views/layouts/navigation.blade.php index 38127a9..5fd7925 100755 --- a/resources/views/layouts/navigation.blade.php +++ b/resources/views/layouts/navigation.blade.php @@ -237,8 +237,10 @@ @endif + + -
+
@csrf