I have tried with Route::currentRouteName() but it is getting the entire view like this users.index/id.create which is invalid. I only need the users/ bit.
Thanks.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I want to be able to do something like href="{{ route }}/{{ id }}/create" where {{ route }} is getting the current route.
I am generating a "add new" button on different views. Each of these views have a controller where I have the create method. I managed to get the id dynamically but I want to do the same thing for the route. Because If I hard code the path like /users/{{ id }}/create/ since this is dynamically generated on multiple views, I want to be able to point to the correct path {{ route }} instead of /users.
Hope it makes sense.
Thanks.
Problem solved:
{{ \Request::segment(1) . '/' . $id . '/create' }}
Please or to participate in this conversation.