Skip to content

Commit 55bc083

Browse files
committed
feat: align email templates with current Laravel framework
- html.blade.php: switch → match for button colour, @component('mail::button') → <x-mail::button>, subcopy updated to use \$displayableActionUrl with break-all span, salutation comma moved inside the lang string - text.blade.php: same switch → match and salutation fix; subcopy outputs \$displayableActionUrl as plain text; button keeps @component (text-safe) - mail/html/message.blade.php: rewritten from @component('mail::layout') / @slot syntax to <x-mail::layout> / <x-slot:*> throughout; unsubscribe block still injected into the footer via the existing @slot mechanism - mail/text/message.blade.php: same layout syntax update https://claude.ai/code/session_01R4pAjWwGY8xKspsdU8xnsy
1 parent d9b145a commit 55bc083

4 files changed

Lines changed: 56 additions & 64 deletions

File tree

resources/views/html.blade.php

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,14 @@
1919
{{-- Action Button --}}
2020
@isset($actionText)
2121
<?php
22-
switch ($level) {
23-
case 'success':
24-
case 'error':
25-
$color = $level;
26-
break;
27-
default:
28-
$color = 'primary';
29-
}
22+
$color = match ($level) {
23+
'success', 'error' => $level,
24+
default => 'primary',
25+
};
3026
?>
31-
@component('mail::button', ['url' => $actionUrl, 'color' => $color])
27+
<x-mail::button :url="$actionUrl" :color="$color">
3228
{{ $actionText }}
33-
@endcomponent
29+
</x-mail::button>
3430
@endisset
3531

3632
{{-- Outro Lines --}}
@@ -43,20 +39,20 @@
4339
@if (! empty($salutation))
4440
{{ $salutation }}
4541
@else
46-
@lang('Regards'),<br>{{ config('app.name') }}
42+
@lang('Regards,')<br>
43+
{{ config('app.name') }}
4744
@endif
4845

4946
{{-- Subcopy --}}
5047
@isset($actionText)
5148
@slot('subcopy')
5249
@lang(
53-
"If youre having trouble clicking the \":actionText\" button, copy and paste the URL below\n".
54-
'into your web browser: [:actionURL](:actionURL).',
50+
"If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\n".
51+
'into your web browser:',
5552
[
5653
'actionText' => $actionText,
57-
'actionURL' => $actionUrl,
5854
]
59-
)
55+
) <span class="break-all">[{{ $displayableActionUrl }}]({{ $actionUrl }})</span>
6056
@endslot
6157
@endisset
6258

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
@component('mail::layout')
1+
<x-mail::layout>
22
{{-- Header --}}
3-
@slot('header')
4-
@component('mail::header', ['url' => config('app.url')])
3+
<x-slot:header>
4+
<x-mail::header :url="config('app.url')">
55
{{ config('app.name') }}
6-
@endcomponent
7-
@endslot
6+
</x-mail::header>
7+
</x-slot:header>
88

99
{{-- Body --}}
10-
{{ $slot }}
10+
{!! $slot !!}
1111

1212
{{-- Subcopy --}}
1313
@isset($subcopy)
14-
@slot('subcopy')
15-
@component('mail::subcopy')
16-
{{ $subcopy }}
17-
@endcomponent
18-
@endslot
14+
<x-slot:subcopy>
15+
<x-mail::subcopy>
16+
{!! $subcopy !!}
17+
</x-mail::subcopy>
18+
</x-slot:subcopy>
1919
@endisset
2020

2121
{{-- Footer --}}
22-
@slot('footer')
23-
@component('mail::footer')
24-
© {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.')
22+
<x-slot:footer>
23+
<x-mail::footer>
24+
© {{ date('Y') }} {{ config('app.name') }}. {{ __('All rights reserved.') }}
2525
@isset($unsubscribe)
26-
<br />
27-
{{ $unsubscribe }}
26+
<br>
27+
{!! $unsubscribe !!}
2828
@endisset
29-
@endcomponent
30-
@endslot
31-
@endcomponent
29+
</x-mail::footer>
30+
</x-slot:footer>
31+
</x-mail::layout>
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
@component('mail::layout')
1+
<x-mail::layout>
22
{{-- Header --}}
3-
@slot('header')
4-
@component('mail::header', ['url' => config('app.url')])
3+
<x-slot:header>
4+
<x-mail::header :url="config('app.url')">
55
{{ config('app.name') }}
6-
@endcomponent
7-
@endslot
6+
</x-mail::header>
7+
</x-slot:header>
88

99
{{-- Body --}}
1010
{{ $slot }}
1111

1212
{{-- Subcopy --}}
1313
@isset($subcopy)
14-
@slot('subcopy')
15-
@component('mail::subcopy')
14+
<x-slot:subcopy>
15+
<x-mail::subcopy>
1616
{{ $subcopy }}
17-
@endcomponent
18-
@endslot
17+
</x-mail::subcopy>
18+
</x-slot:subcopy>
1919
@endisset
2020

2121
{{-- Footer --}}
22-
@slot('footer')
23-
@component('mail::footer')
24-
© {{ date('Y') }} {{ config('app.name') }}. @lang("All rights reserved.\n")
25-
@isset($unsubscribe)
22+
<x-slot:footer>
23+
<x-mail::footer>
24+
© {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.')
25+
@isset($unsubscribe)
2626
{{ $unsubscribe }}
27-
@endisset
28-
@endcomponent
29-
@endslot
30-
@endcomponent
27+
@endisset
28+
</x-mail::footer>
29+
</x-slot:footer>
30+
</x-mail::layout>

resources/views/text.blade.php

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,10 @@
1919
{{-- Action Button --}}
2020
@isset($actionText)
2121
<?php
22-
switch ($level) {
23-
case 'success':
24-
case 'error':
25-
$color = $level;
26-
break;
27-
default:
28-
$color = 'primary';
29-
}
22+
$color = match ($level) {
23+
'success', 'error' => $level,
24+
default => 'primary',
25+
};
3026
?>
3127
@component('mail::button', ['url' => $actionUrl, 'color' => $color])
3228
{{ $actionText }}
@@ -43,20 +39,20 @@
4339
@if (! empty($salutation))
4440
{{ $salutation }}
4541
@else
46-
@lang('Regards'),<br>{{ config('app.name') }}
42+
@lang('Regards,')
43+
{{ config('app.name') }}
4744
@endif
4845

4946
{{-- Subcopy --}}
5047
@isset($actionText)
5148
@slot('subcopy')
5249
@lang(
53-
"If youre having trouble clicking the \":actionText\" button, copy and paste the URL below\n".
54-
'into your web browser: [:actionURL](:actionURL).',
50+
"If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\n".
51+
'into your web browser:',
5552
[
5653
'actionText' => $actionText,
57-
'actionURL' => $actionUrl,
5854
]
59-
)
55+
) {{ $displayableActionUrl }}
6056
@endslot
6157
@endisset
6258

0 commit comments

Comments
 (0)