カスタマイズLaravel確認メール

xtremeCODE:

私はLaravel確認メールをカスタマイズしようとしていてください

私のユーザモデルでは、私はこれを持っています

  public function sendEmailVerificationNotification()
    {
        $this->notify(new MyNotification);
    }

Iその後、RAN

PHP職人メイク:通知MyNotification

その中で、私はこれを持っています

<?php

namespace App\Notifications;
use Auth;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Auth\Notifications\VerifyEmail;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Lang;
use Illuminate\Support\Facades\URL;


class MyNotification extends Notification
{
    use Queueable;

    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['mail'];
    }

    /**
     * Get the mail representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return \Illuminate\Notifications\Messages\MailMessage
     */
    public function toMail($notifiable)
    {

        return (new MailMessage)
        ->subject('Verify Email Address')
        //I am trying output Hello User Name
        ->greeting('Hello!' {Auth::user()->name} )
        ->line('The introduction to the notification.')
        ->line('Please click the button below to verify your email address.')
        ->action(Lang::get('Verify Email Address'), $verificationUrl)
        ->line('If you did not create an account, no further action is required.')
        ->line('Thank you for using our application!');
    }

    /**
     * Get the array representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function toArray($notifiable)
    {
        return [
            //
        ];
    }
}

この

挨拶( 'こんにちは!' {認証::ユーザー() - >名}

エラーを返しました

不正な文字列は「ジョン・ドウ」をオフセット

この

アクション(ラング::取得() 'メールアドレスを確認してください'、$ verificationUrl)

返されるエラー

未定義の変数:verificationUrl

私はその後、これを追加しました

   $verificationUrl = $this->verificationUrl($notifiable);

これは新しいエラーを返しました

未定義のメソッドのApp \通知\ MyNotificationへの呼び出し:: verificationUrl()

私は本当にこの時点で何をするか分かりません。

アントン・ネメス:
  1. 挨拶の修正:
->greeting('Hello! ' . Auth::user()->name)
  1. verificationUrlことについては、私はあなたが拡張するために持っていると思う\を照らし\認証\通知\ VerifyEmailを代わりに通知

:この参照https://github.com/laravel/framework/blob/6.x/src/Illuminate/Auth/Notifications/VerifyEmail.phpを

おすすめ

転載: http://10.200.1.11:23101/article/api/json?id=376933&siteId=1