Where is defined the Laravel mail template $slot variable

Viewed 160

Where is defined the $slot variable in the Laravel mail template ?

<tr>
    <td class="header">
        <a href="{{ $url }}" style="display: inline-block;">
            @if (trim($slot) === 'Laravel')
            <img src="https://api.foo.com/foo-logo.svg" class="logo" alt="Laravel Logo">
            @else
            {{ $slot }}
            @endif
        </a>
    </td>
</tr>

I'm using it via:

    public function toMail($notifiable)
    {
        return (new MailMessage)
            ->subject(__('Reset Password Notification'))
            ->line(__('You are receiving this email because we received a password reset request for your account.'))
            ->action(__('Reset Password'), $this->url)
            ->line(__('This password reset link will expire in :count minutes.', ['count' => 60]))
            ->line(__('If you did not request a password reset, no further action is required.'));
    }
1 Answers

All mail templates are stored at resources/views/email. Maybe search for a phrase $slot within this directory.

Also check your mailable class (MailMessage) where the ->view('email.contact-form') method points to…

In my case I have:

return $this
    ->from(config('mail.contact.address'))
    ->replyTo($senderEmail, $senderName)
    ->view('email.contact-form')
    ->with($data);

and mail template is: src/resources/views/email/contact-form.blade.php

Related