CakePHP 3.x: Adding parameter in route

I am trying to use routes.php to connect one route to another. The route I would like to connect is ‘/layouts/editspecial/:id’ I would like this route to go to my Layouts controller edit action, with arguments of id and true, in that order. The id is easy, but I’m unsure how to make the route pass true by default.

Thank you.

You can pass additional params in the route itself like this

$routes->connect('/example/:id', [
    'controller' => 'Pages',
    'action' => 'display',
    true //pass any additional param here
], [
    'id' => '[0-9]+',
    'routeClass' => DashedRoute::class
]);

When you use http://example.com/example/22 you’ll get

http://discourse.cakephp.org/uploads/cakephp/original/1X/eca571e45abe3e86fc6d3ac3ced2e8ffa740f383.png