jeudi 13 avril 2017

Class 'Illuminate\Mail\Events\MessageSent' not found in Laravel 5.4 notification

Please I need help to resolve an issue with notification system.

Here is my notification class

<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;

class ApplicationReceived extends Notification
{
use Queueable;


private $testCode;
private $recipientName;
/**
 * Create a new notification instance.
 *
 * @return void
 */
public function __construct($testCode='',$name='')
{
    $this->testCode=$testCode;
    $this->recipientName=$name;
}

/**
 * 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)
                ->greeting("Dear ".$this->recipientName)
                ->subject('Your Application Received for The Entrepreneur')
                ->line("Your application to participate in The Entrepreneur project has been received by us")
                ->line("Follow the link below to take a test to complete your application")
                ->action('Take Test', url('/taketest/'.$this->testCode))
                ->line('Thank you for your interest in The Entrepreneur project!');
}

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

And this is where I call it

//Notify the candidate
            $candidate->notify(new ApplicationReceived($candidate->testcode, $candidate->othernames));
            return redirect('/signup')->with('msg', "<div class='alert alert-success'><strong>Your registration information was successfully submitted!</strong><br /> Please check your email for a link to take a test to complete your enrollment!!!</div>");

When the application runs, it sends the notification but then throws up the following fatal error message

FatalErrorException in Mailer.php line 470: Class 'Illuminate\Mail\Events\MessageSent' not found

the error displayed

I will appreciate any help to point out where I am going wrong here.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2oCIm9t
via IFTTT

Aucun commentaire:

Enregistrer un commentaire