Supervisor issue ? Notification cache? Laravel notification (Customizing The Templates) sometimes used old view

48 views Asked by At

I handle old project laravel 6.*

For sending email I using customize template notification for laravel from https://laravel.com/docs/6.x/notifications#customizing-the-templates

after I run

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

It will create folder

resource/views/vendor/notifications/email.blade.php

And I custom the file email.blade.php

Something like [after]

@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

{{-- Action Button --}}
@isset($actionText)
<?php
    switch ($level) {
        case 'success':
        case 'error':
            $color = $level;
            break;
        default:
            $color = 'yellow';
            break;
    }
?>
@component('mail::button', ['url' => $actionUrl, 'color' => $color])
{{ $actionText }}
@endcomponent
@endisset

{{-- Outro Lines --}}
@foreach ($outroLines as $line)
{{ $line }}

@endforeach

{{-- Salutation --}}
@if (! empty($salutation))
{{ $salutation }}
@else
@lang('Regards'),<br>
UOI Corps <br>
<br>
<br>
<?php
    $icon = config('app.icon_url');
    echo '<table><tr style="padding:13px;"><td style="display:flex; margin-right: 3px;"><img src='.$icon.' width="101px" height="31px"/></td><td><p style="font-size: 14px;">UOI Corps</p></td></tr></table>';
?>
@endif

{{-- Subcopy --}}
@isset($actionText)
@slot('subcopy')
@lang(
    "If you’re having trouble clicking the \":actionText\" button, copy and paste the URL below\n".
    'into your web browser: [:actionURL](:actionURL)',
    [
        'actionText' => $actionText,
        'actionURL' => $actionUrl,
    ]
)
@endslot
@endisset
@endcomponent

and before editing with new code just different change on: [before]

  • $icon => read config('app.icon_url'); icon_url from env and value is just url image.
  • change the color 'primary' to 'yellow', here's a code
  • some word UOI to UOI Corps

here's file before I change the 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

{{-- Action Button --}}
@isset($actionText)
<?php
    switch ($level) {
        case 'success':
        case 'error':
            $color = $level;
            break;
        default:
            $color = 'primary';
            break;
    }
?>
@component('mail::button', ['url' => $actionUrl, 'color' => $color])
{{ $actionText }}
@endcomponent
@endisset

{{-- Outro Lines --}}
@foreach ($outroLines as $line)
{{ $line }}

@endforeach

{{-- Salutation --}}
@if (! empty($salutation))
{{ $salutation }}
@else
@lang('Regards'),<br>
UOI<br>
<br>
<br>
<?php
    $icon = config('app.icon_url');
    echo '<table><tr style="padding:13px;"><td style="display:flex; margin-right: 3px;"><img src='.$icon.' width="101px" height="31px"/></td><td><p style="font-size: 14px;">UOI</p></td></tr></table>';
?>
@endif

{{-- Subcopy --}}
@isset($actionText)
@slot('subcopy')
@lang(
    "If you’re having trouble clicking the \":actionText\" button, copy and paste the URL below\n".
    'into your web browser: [:actionURL](:actionURL)',
    [
        'actionText' => $actionText,
        'actionURL' => $actionUrl,
    ]
)
@endslot
@endisset
@endcomponent

other information file on .env file

CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_CONNECTION=database
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_ENCRYPTION=tls
[email protected]
MAIL_FROM_NAME="UOI Corps" -> before change it's "UOI"
  1. using supervisor to handle queue to send notification mail

Then I faced issue sometimes change are applied and sometimes arte not applied. For example, I got email with word expected as "UOI Corps" and sometimes get old view as word "UOI". and sender email sometimes "UOI Corps" and sometimes get sender as "UOI"

The issue same on this thread https://laracasts.com/discuss/channels/laravel/notification-class-cached

What I have done:

  • fresh build and restart supervisor
  • laravel clear cache and config
composer dump-autoload
php artisan clear-compiled
php artisan cache:clear
php artisan view:clear
php artisan route:clear
php artisan optimize
  • remove file on folder bootstrap/cache/*

  • remove file on folder storage/framework/views/*

  • re-publish with

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

After all I try it's still issue ?? What anyting else to fix it ??

Thanks.

0

There are 0 answers