2016-11-15 3 views
1

メール内のメッセージを翻訳したいと思います。laravelのパスワードリセットメールを変更する

vendor/laravel/framework/src/Illuminate/Auth/Notifications/ResetPassword.php

public function toMail() 
{ 
    return (new MailMessage) 
     ->line([ 
      'You are receiving this email because we received a password reset request for your account.', 
      'Click the button below to reset your password:', 
     ]) 
     ->action('Reset Password', url('password/reset', $this->token)) 
     ->line('If you did not request a password reset, no further action is required.'); 
} 

メッセージを変更するための最良の方法は何ですか?かなり確信して私は5.3 docsから

答えて

2

..このファイルでそれを変更しないでください。

あなたは簡単にユーザーにパスワードリセットのリンクを送信するために使用される通知のクラスを変更することがあります。まず、UserモデルのsendPasswordResetNotificationメソッドをオーバーライドします。この方法では、選択した通知クラスを使用して通知を送信することができます。

public function sendPasswordResetNotification($token) 
{ 
    $this->notify(new ResetPasswordNotification($token)); 
} 

は、この情報がお役に立てば幸い:パスワードリセット$トークンは、法によって受信された最初の引数です。

0

Localization in docから、言語文字列はresources/langディレクトリ内のファイルに格納されます。例: messages.php

<?php 

return [ 
    'welcome' => 'Welcome to our application' 
]; 

とトランス機能を使用します。

echo trans('messages.welcome');