• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Combine multiple filter in single alias filter

#1
Source: https://codeigniter4.github.io/userguide...ml#aliases 

In CI4 documentation, is written, for use single alias, and multiple filter, set $aliases in this mode:
PHP Code:
public $aliases = [
        'csrf' => \CodeIgniter\Filters\CSRF::class,
        'toolbar' => \CodeIgniter\Filters\DebugToolbar::class,
        'honeypot' => \CodeIgniter\Filters\Honeypot::class,
        'authrequest' => [
            \App\Filters\ValidHeaders::class,
            \App\Filters\IsAuth::class,
        ]
    ]; 

and my routes is configure in this mode:
PHP Code:
$routes->group('api/v1', function ($routes) {

    $routes->resource('authentication');
    $routes->group('authentication', function ($routes) {
        $routes->delete('/''Authentication::revoke', ['filter' => 'authrequest']);
    });

}); 

But I received this error:
Code:
{
  "title": "Error",
  "type": "Error",
  "code": 500,
  "message": "Class name must be a valid object or a string",
  "file": "/Users/carminemilieni/Documents/GitHub/app/vendor/codeigniter4/framework/system/Filters/Filters.php",
  "line": 152,
  "trace": [
    {
      "file": "/Users/carminemilieni/Documents/GitHub/app/vendor/codeigniter4/framework/system/CodeIgniter.php",
      "line": 313,
      "function": "run",
      "class": "CodeIgniter\\Filters\\Filters",
      "type": "->",
      "args": [
        "api/v1/authentication",
        "before"
      ]
    },
    {
      "file": "/Users/carminemilieni/Documents/GitHub/app/vendor/codeigniter4/framework/system/CodeIgniter.php",
      "line": 245,
      "function": "handleRequest",
      "class": "CodeIgniter\\CodeIgniter",
      "type": "->",
      "args": [
        null,
        {
          "handler": "file",
          "backupHandler": "dummy",
          "storePath": "/Users/carminemilieni/Documents/GitHub/app/writable/cache/",
          "cacheQueryString": false,
          "prefix": "",
          "memcached": {
            "host": "127.0.0.1",
            "port": 11211,
            "weight": 1,
            "raw": false
          },
          "redis": {
            "host": "127.0.0.1",
            "password": null,
            "port": 6379,
            "timeout": 0,
            "database": 0
          },
          "validHandlers": {
            "dummy": "CodeIgniter\\Cache\\Handlers\\DummyHandler",
            "file": "CodeIgniter\\Cache\\Handlers\\FileHandler",
            "memcached": "CodeIgniter\\Cache\\Handlers\\MemcachedHandler",
            "predis": "CodeIgniter\\Cache\\Handlers\\PredisHandler",
            "redis": "CodeIgniter\\Cache\\Handlers\\RedisHandler",
            "wincache": "CodeIgniter\\Cache\\Handlers\\WincacheHandler"
          }
        },
        false
      ]
    },
    {
      "file": "/Users/carminemilieni/Documents/GitHub/app/public_api/index.php",
      "line": 47,
      "function": "run",
      "class": "CodeIgniter\\CodeIgniter",
      "type": "->",
      "args": []
    }
  ]
}
 
Solutions? Thanks.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.