Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

SachinAgarwal's avatar

Ignoring few Route Parameters

My Route is like this:

{prefix}/registrations/{id}

What I want is get only {id} in my controller. and not {prefix}

i.e

// I want id to have the id from route and not the prefix
public function show($id){}

// But actually this is what is happening
public function show($prefix, $id ){}

0 likes
7 replies
bashy's avatar

Don't think you can? Why do you need it the other way around?

martinbean's avatar

@SachinAgarwal If you’re doing explicit route–model binding for the ID, then you could unset the prefix parameter there, but I recommend against it as it could have a knock-on affect with the rest of your routing.

Mircea's avatar

Add method below into app/Http/Controllers/Controller.php

public function callAction($method, $parameters)
{
    unset($parameters['prefix']);

    return parent::callAction($method, $parameters);
}
4 likes

Please or to participate in this conversation.