mardi 20 mars 2018

Error sending notification expecting Notification instance of __PHP_Incomplete_Class given

I'm trying to send a normal notification to an auth user using the notify method.

My code's really simple.

auth()->user()->notify(new AppointmentRequestNotification($customerRequest));

And my Notification Class is:

<?php

namespace App\Notifications;

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

class AppointmentRequestNotification extends Notification implements ShouldQueue
{
    use Queueable;

    private $customerRequest;

    public function __construct( CustomerRequest $customerRequest )
    {
        $this->customerRequest = $customerRequest;
        $this->onQueue('notifications');
    }

    .
    .
    .

    public function toMail($notifiable)
    {

        return (new MailMessage)
                    ->subject('You Appointment Request Has Been Sent')
                    ->line('Your appointment request has been sent! You will be contacted by the provider’s office shortly to confirm appointment details.')
                    ->line($this->customerRequest->emailDetailView());
    }
}

And when I open the failed jobs this is the exception:

Symfony\Component\Debug\Exception\FatalThrowableError: Type error: Argument 2 passed to Illuminate\Notifications\Channels\MailChannel::send() must be an instance of Illuminate\Notifications\Notification, instance of __PHP_Incomplete_Class given, called in /home/forge/medixaiddemo.staging71.agileelement.com/vendor/laravel/framework/src/Illuminate/Notifications/NotificationSender.php on line 113 in /home/forge/medixaiddemo.staging71.agileelement.com/vendor/laravel/framework/src/Illuminate/Notifications/Channels/MailChannel.php:46



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

Aucun commentaire:

Enregistrer un commentaire