Is there a way to retrieve the parent URL of the current URL in blade? For example, if I am at /users/1
I want to get to /users
. E.g.:
<a href="{{ parent() }}">Back</a>
I want it to be reusable for all resources, so I don't want url('/users')
.
Here is my solution:
@php $url = url()->current(); @endphp
<a href="{{ substr($url,0,strrpos($url,'/')) }}">Back</a>