随着 Laravel 5.7 的发布,Illuminate\Notifications\Notification 类开始提供一个 locale 方法来设置所需的语言。格式化通知时,应用程序将更改为此区域设置,然后在格式化完成后恢复到先前的区域设置。以下是此功能的示例:
$user->notify((new InvoicePaid($invoice))->locale('ar'));
Run Code Online (Sandbox Code Playgroud)
我只需要在 lumen(最新版本)中使用这个功能,但是当我实现那个 Like文档时说我得到了一个错误
Call to undefined method Laravel\Lumen\Application::getLocale()
这是因为在流明应用中没有getLocale或没有setLocale方法..所以有任何解决这个问题的想法。