lundi 2 juillet 2018

Laravel: Cannot set locale in Mailable

I updated to Laravel 5.6 and I want to use the new locale method from a Mailable class.

I created a mailable class with

php artisan make:mail Test --markdown="emails.test"

This is my blade file:

@component('mail::message')
@lang('list.test')
@endcomponent

If I send a mail

  $test = new \App\Mail\Test();
  $test->locale('de');
  \Mail::to('myemail@test.com')->send($test);

Then the mail is not using my locale file from resources/lang/de/list.php

<?php 

   return [ 'test' => 'Dies ist ein Test'];

Why is that?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire