Livewire Urls is an amazing package that gives you a simple way to retrieve the current and previous URL in Livewire. This means that the usual methods like URL()->current() point to an internal Livewire route, instead of the "real route" your user is on.

Current URL use RalphJSmit\Livewire\Urls\Facades\Url; $currentUrl = Url::current(); Current route $currentRouteName = Url::currentRoute(); The Url::currentRoute() returns null when the user is on a route without a name. Previous url $previousUrl = Url::previous(); The Url::previous() method returns null when there isn't a previous route available.

The Url::lastRecorded() would give you the URL of page A. The function returns null when there isn't another URL found, apart from the current session.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Community Partners