📌  相关文章
📜  为验证错误添加自定义属性 laravel - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:55.099000             🧑  作者: Mango

代码示例1
# add custom attribute for validation errors laravel 8
$rules = [
  'account_number' => ['required','digits:10','max:10','unique:bank_details']
];
$messages = [];
$attributes = [
    'account_number' => 'Mobile number',
];
$request->validate($rules,$messages,$attributes);
// OR
$validator = Validator::make($request->all(), $rules, $messages, $attributes);