Я пытаюсь обновить уведомление по электронной почте в Laravel. Я попытался создать ссылку для проверки в AppServiceProvider, затем передал ссылку в класс уведомлений, но позже он выдал ошибку «неопределенное свойство :: $ view».
AppServiceProvider
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
VerifyEmail::toMailUsing(function ($notifiable) {
$verificationUrl = URL::temporarySignedRoute(
'verification.verify',
Carbon::now()->addMinutes(config('auth.verification.expire', 60)),
[
'id' => $notifiable->getKey(),
'hash' => sha1($notifiable->getEmailForVerification()),
]
);
return new EmailVerification($verificationUrl);
});
}
VerificationEmail
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class EmailVerification extends Notification implements ShouldQueue
{
use Queueable;
public $verificationUrl;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct($verificationUrl)
{
$this->verificationUrl = $verificationUrl;
}
/**
* 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)
{
$verificationUrl = $this->verificationUrl;
return (new MailMessage)
->subject('Please verify your email')
->markdown('emails.verification', ['url' => $verificationUrl]);
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
}
Связанное представление уценки с Уведомлением.
@component('mail::message')
# Email verification - {{ config('app.name') }}
Your registration on our application <b> {{ config('app.name') }} </b> was successfull. Kindly click the button below to verify your email address.
@component('mail::button', ['url' => $url])
Verify Email
@endcomponent
Thanks,<br>
{{ config('app.name') }}
@endcomponent
Я получаю ошибку
** ErrorException Неопределенное свойство: App \ Notifications \ EmailVerification :: $ view **