Here's a simple controller to demonstrate:
Code:
<?php namespace App\Controllers;
use CodeIgniter\Controller;
class Tests extends Controller
{
public function _remap($method, ...$params)
{
if (! method_exists($this, $method))
{
return redirect('/tests/hidden');
}
$this->{$method}(...$params);
}
public function hidden()
{
echo '<h1>You found it!</h1>';
}
}
Navigate to
/tests/hidden, and the page displays like you would expect. Navigate to
/tests and you will be redirected to the hidden method.
I did confirm something is going screwy with the filtering and redirects but not sure what yet. I've got some plans this evening, but hopefully will have a chance to look into it.