请告知如何本地化闪存消息?我关注 laracast 系列:https ://laracasts.com/series/build-project-flyer-with-me/episodes/9
Auth::login(User::firstOrCreate($data));
flash()->success('flash.success', 'flash.login');
return redirect($this->redirectPath());`
请告知如何本地化闪存消息?我关注 laracast 系列:https ://laracasts.com/series/build-project-flyer-with-me/episodes/9
Auth::login(User::firstOrCreate($data));
flash()->success('flash.success', 'flash.login');
return redirect($this->redirectPath());`
return redirect('/login')->with('status', trans('auth.registered'));
在资源/lang/es/auth.php
return [
...
'registered' => "Your message translated on Spanish.",
];
你可以这样做
在你的控制器中
return redirect('/login')->with('success', __('auth.registered'));
在 lang 文件中,例如使用En和Ar
转到lang/en/auth
并创建您的状态消息
'registered' => 'Your message in English'
转到lang/ar/auth
并创建您的状态消息
'registered' => 'Your message in Arabic'
然后在您的刀片中,您从控制器检索即将到来的消息
@if(session('success'))
<div class="alert alert-success" role="alert">
<div class="alert-body">
{{session('success')}}
</div>
</div>
@endif
了解本地化Laravel Localization
您可以找到更多信息