F
Filament9mo ago
Sawal

current url, /livewire/update

i try to dd current url when export action button is clicked, but the url instead of show my actual current url, it only show "http://127.0.0.1:8000/livewire/update"
No description
No description
12 Replies
Jon Mason
Jon Mason8mo ago
That's because livewire is making ajax calls behind the scenes, so initial pagel oad will be your expected url, and then subsequent calls will be livewire/update. You could set the url value in your mount method and then reference it in your action, perhaps.
Dennis Koch
Dennis Koch8mo ago
Maybe tell us what you are trying to do. Then we can suggest an alternative
Adnan Yalahow
Adnan Yalahow8mo ago
for example my actual url is http://localhost:8000/posts/35/edit but dd(url()->current()); is showing "http://localhost:8000/livewire/update"
Dennis Koch
Dennis Koch8mo ago
That’s correct. It’s a Livewire request. They all go through the same endpoint
Adnan Yalahow
Adnan Yalahow8mo ago
so how do i get my actual url this one http://localhost:8000/posts/35/edit
Adnan Yalahow
Adnan Yalahow8mo ago
after following instructions am getting null
krekas
krekas8mo ago
what's the use case for getting the current url?
Adnan Yalahow
Adnan Yalahow8mo ago
am in modal and i needed to have that id in this case 35
krekas
krekas8mo ago
modal of current record? can't you get id from the record?
Adnan Yalahow
Adnan Yalahow8mo ago
I am not in Post modal am in another modal thats why i can't get record
Dennis Koch
Dennis Koch8mo ago
->action(fn ($livewire) => $livewire->record->id) ?

Did you find this page helpful?