【发布时间】:2020-04-06 03:50:55
【问题描述】:
我正在尝试将我的错误信息翻译成法语。但验证消息包含在
app/Rules/MatchOldPassword.php文件
我已经翻译了validation.php文件中的错误信息,但是我如何翻译这个在不同路径中的错误信息
这是我的 MatchOldPassword.php 代码
<?php
namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;
use Illuminate\Support\Facades\Hash;
class MatchOldPassword implements Rule
{
/**
* Determine if the validation rule passes.
*
* @param string $attribute
* @param mixed $value
* @return bool
*/
public function passes($attribute, $value)
{
return Hash::check($value, auth()->user()->password);
}
/**
* Get the validation error message.
*
* @return string
*/
public function message()
{
return 'The :attribute need to be matched the with old password.';
}
}
【问题讨论】:
标签: php laravel translation laravel-6 rules