Welcome Guest, Not a member yet? Register   Sign In
Issue with the controller arguement
#12

(This post was last modified: 07-12-2018, 07:48 AM by kilishan.)

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.
Reply


Messages In This Thread
Issue with the controller arguement - by scalla - 07-10-2018, 05:42 PM
RE: Issue with the controller arguement - by kilishan - 07-12-2018, 07:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB