Validate Verification of tp5

use a custom validation scenario in the controller, but how to use the custom error prompt in the scenario

clipboard.png

Aug.13,2021

    protected $rule =   [
        'name'  => 'require|max:25',
        'age'   => 'number|between:1,120',
        'email' => 'email',    
    ];
    
    protected $message  =   [
        'name.require' => '',
        'name.max'     => '25',
        'age.number'   => '',
        'age.between'  => '1-120',
        'email'        => '',    
    ];
    
    protected $scene = [
        'edit'  =>  ['name','age'],
    ];

tp5.1 https://www.kancloud.cn/manua.
tp5.0 https://www.kancloud.cn/manua.
documents are all written in message.


take a good look at the manual

Menu