Laravel validation attributes “nice names”

后端 未结 10 1777
[愿得一人]
[愿得一人] 2020-12-02 05:41

I\'m trying to use the validation attributes in \"language > {language} > validation.php\", to replace the :attribute name (input name) for a proper to read name (example: f

10条回答
  •  既然无缘
    2020-12-02 06:25

    In Laravel 7.

    use Illuminate\Support\Facades\Validator;
    

    Then define niceNames

    $niceNames = array(
       'name' => 'Name',
    );
    

    And the last, just put $niceNames in fourth parameter, like this:

    $validator = Validator::make($request->all(), $rules, $messages, $niceNames);
    

提交回复
热议问题