At the root of the project ('/') I have a dashboard kind of page that is routed to 'Patterns:: index'. This works fine for loading the page with a GET, but I also have a form on this page that I want to send a POST request to the same action.
config/routes.php
Router::connect('/', 'Patterns::index');
The form create line on the view looks like so:
<?= $this->form->create($filter, ['url' => ['Patterns::index'], 'method' => 'post']) ?>
Note: it has also looked like this, but it didn't work either:
<?= $this->form->create($filter) ?>
The action that is generated by this form is the correct path to the project '../client-name' (the root), with a method of POST. But when I hit submit it tries to send the request to this route and gets a 301 then redirects to '../client-name/' (note the trailing forward slash).
If I manually edit the action in the browser in the HTML to have the trailing forward slash the request goes through as expected - It sends a POST request to 'Patterns::index'.
Something else to note is that if I remove the line in config/routes and just access it by going to '/patterns' everything works as intended...
Can someone point me in the right direction?