Welcome Guest, Not a member yet? Register   Sign In
New Registrar Feature
#6

(10-23-2023, 02:49 AM)donpwinston Wrote:
(10-22-2023, 10:06 PM)kenjis Wrote:
(10-22-2023, 06:36 PM)donpwinston Wrote: What is this CodeIgniter\Shield\Config namespace?

It is just sample code. It is a sample namespace.
Probably in your context, a namespace that you use.

Quote:Any namespace may define implicit registrars by using the Config/Registrar.php file. These files are classes whose methods are named for each configuration class you wish to extend.
https://codeigniter4.github.io/CodeIgnit...registrars

So I could create a app/Config/Registrar.php file like this:
PHP Code:
<?php // $Id$

namespace App\MyConfig;

use 
App\Filters\{DOSFilterHostFilterLoginSecurityFilter};
use 
App\Validation\NcrsEbnRules;

class 
Registrar
{
  public static function Filters(): array
  {
    return [
      'aliases' => [
        'host' => HostFilter::class,
        'dos' => DOSFilter::class,
        'loginsecurity' => LoginSecurityFilter::class,
      ],
      'globals' => [
        'before' => [
          'host',
          'dos',
          'loginsecurity',
        ],
      ],
      'methods' => [
        'post' => ['csrf'],
      ],
    ];
  }

  public static function Validation(): array
  {
    return [
      'ruleSets' => [
        NcrsEbnRules::class,
      ],
    ];
  }

This works!
Simpler is always better
Reply


Messages In This Thread
New Registrar Feature - by donpwinston - 10-22-2023, 06:36 PM
RE: New Registrar Feature - by InsiteFX - 10-22-2023, 09:57 PM
RE: New Registrar Feature - by kenjis - 10-22-2023, 10:06 PM
RE: New Registrar Feature - by donpwinston - 10-23-2023, 02:49 AM
RE: New Registrar Feature - by donpwinston - 10-28-2023, 12:21 AM
RE: New Registrar Feature - by kenjis - 10-22-2023, 10:28 PM



Theme © iAndrew 2016 - Forum software by © MyBB