schutte
schutte

Reputation: 2166

How to customize/change the header logo of notification mail (laravel)

I have no idea where could I found the header logo example below(squared):

enter image description here

My content code:

public function toMail($notifiable)
{
    return (new MailMessage) 
        ->line('The introduction to the notification.'.$user->name)
        ->line('Hey Now hey now')
        ->action('Notification Action', route('register.select'))
        ->line('Thank you for using our application!');
}


EDITED: in email.blade.php:

@component('mail::message')
{{-- Greeting --}}
@if (! empty($greeting))
# {{ $greeting }}
@else
@if ($level === 'error')
# @lang('Whoops!')
@else
# @lang('Hello!')
@endif
@endif

{{-- Intro Lines --}}
@foreach ($introLines as $line)
{{ $line }}

@endforeach

... and so on, and so forth


I want to customize that logo header, my problem I can't find where exactly. Need your help Sirs.

Upvotes: 9

Views: 18291

Answers (2)

brunofarias
brunofarias

Reputation: 94

It only shows the Laravel logo if the APP_NAME in the .env is set as "Laravel".

So once you change this setting it will omit the default logo. if you want to change it to display something else you can publish the mail components as other answers showed and customize it.

Upvotes: 6

Styx
Styx

Reputation: 10076

You just have to customize mail templates.

Run this command:

php artisan vendor:publish --tag=laravel-notifications

After that you'll find templates in resources/views/vendor/notifications.


If you want to customize mail components used in templates:

php artisan vendor:publish --tag=laravel-mail

You'll find components in resources/views/vendor/mail. The ones you want are message.blade.php and header.blade.php.

Upvotes: 28

Related Questions