How to Get the Mailable className

Posted 6 months ago by yassineqoraiche

is there any way to get the mailable className (App/mail/OrderShipped) from the fired event (Mail\Events\MessageSending):

<?php

namespace App\Listeners;

use Illuminate\Mail\Events\MessageSending;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;

class LogSendingMessage
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param  MessageSending  $event
     * @return void
     */
    public function handle(MessageSending $event)
    {

    // for example:
        $event->mailable == 'Ordershipped';
    }
}

Thanks

Please sign in or create an account to participate in this conversation.