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"
12 Replies
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.
Maybe tell us what you are trying to do. Then we can suggest an alternative
for example my actual url is http://localhost:8000/posts/35/edit but dd(url()->current()); is showing "http://localhost:8000/livewire/update"
That’s correct. It’s a Livewire request. They all go through the same endpoint
so how do i get my actual url this one http://localhost:8000/posts/35/edit
this may help
https://github.com/ralphjsmit/livewire-urls
after following instructions am getting null
what's the use case for getting the current url?
am in modal and i needed to have that id in this case 35
modal of current record? can't you get id from the record?
I am not in Post modal am in another modal thats why i can't get record
->action(fn ($livewire) => $livewire->record->id)
?