Welcome Guest, Not a member yet? Register   Sign In
Make Validation Config to Extend BaseConfig
#1

I am creating a project which includes so may plug and play modules, I use Registrar to Extend Filters and Some other Configs, But the Validation Config doesn't extend the BaseConfig so I can't add rules to it except I modify it directly. 
It would be nice to place all rules into a $rules property so that different modules can add theirs to it.
e.g
PHP Code:
<?php

namespace Config;

use 
CodeIgniter\Config\BaseConfig;
use 
CodeIgniter\Validation\CreditCardRules;
use 
CodeIgniter\Validation\FileRules;
use 
CodeIgniter\Validation\FormatRules;
use 
CodeIgniter\Validation\Rules;

class 
Validation extends BaseConfig
{
    //--------------------------------------------------------------------
    // Setup
    //--------------------------------------------------------------------

    /**
    * Stores the classes that contain the
    * rules that are available.
    *
    * @var string[]
    */
    public $ruleSets = [
        Rules::class,
        FormatRules::class,
        FileRules::class,
        CreditCardRules::class,
    ];

    /**
    * Specifies the views that are used to display the
    * errors.
    *
    * @var array<string, string>
    */
    public $templates = [
        'list'  => 'CodeIgniter\Validation\Views\list',
        'single' => 'CodeIgniter\Validation\Views\single',
    ];

    //--------------------------------------------------------------------
    // Rules
    //--------------------------------------------------------------------
    public $rules = [
        'login'=>[
            //
        ]
    ];

Reply


Messages In This Thread
Make Validation Config to Extend BaseConfig - by sadiqsalau - 02-01-2022, 03:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB