codeigniter4 / CodeIgniter4

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
5.3k stars 1.89k forks source link

Make Validation Config to Extend BaseConfig #5702

Closed sadiqsalau closed 2 years ago

sadiqsalau commented 2 years ago

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

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'=>[
            //
        ]
    ];
} ```
kenjis commented 2 years ago

We use GitHub issues to track BUGS and to track approved DEVELOPMENT work packages. We use our forum to provide SUPPORT and to discuss FEATURE REQUESTS.

If you raise an issue here that pertains to support or a feature request, it will be closed! If you are not sure if you have found a bug, raise a thread on the forum first - someone else may have encountered the same thing. https://github.com/codeigniter4/CodeIgniter4#repository-management

Why don't you send a PR? See https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/README.md

paulbalandan commented 2 years ago

If you raise an issue here that pertains to support or a feature request, it will be closed!

Please send a PR instead.