【发布时间】:2013-11-13 02:23:27
【问题描述】:
我对如何在 laravel 4 验证后管理错误消息中的数据库字段名称有一点疑问。
为了验证表单,我使用了 eloquent,如下所示:
public static function validate($input)
{
$validation = array(
'rules' => array(
'title' => 'required|min:5'
),
'messages' => array(
'title.required' => 'Inserer un titre!'
)
);
return Validator::make($input, $validation['rules'], $validation['messages']);
}
为了翻译错误信息,我使用了这个 github 仓库:https://github.com/caouecs/Laravel4-lang
除了属性(db 列)名称的翻译外,一切都很好。我不知道该怎么做,有什么建议吗?
fr : Le texte **title** doit contenir au moins 5 caractères.
en : The **title** must be at least 5 characters.
(在每种情况下标题都保持英文。)
【问题讨论】: