updating user and language models

This commit is contained in:
2022-12-07 11:42:36 -07:00
parent fdba9f1ae7
commit 64d4d326b7
4 changed files with 9 additions and 7 deletions

View File

@ -42,18 +42,18 @@ class HandleInertiaRequests extends Middleware
*/
public function share(Request $request): array
{
$localeFields = ['locale', 'iso_code', 'name', 'localized_name'];
$localeFields = ['locale_name', 'iso_code', 'name', 'localized_name'];
$currentLocale = $request->session()->get('locale', null);
if (is_null($currentLocale)) {
$currentLocale = Language::where(['locale' => 'en', 'iso_code' => 'en_US'])->get($localeFields)[0]->toArray();
$currentLocale = Language::where(['locale_name' => 'en', 'iso_code' => 'en_US'])->get($localeFields)[0]->toArray();
$request->session()->put('locale', [
'locale' => $currentLocale['locale'],
'locale_name' => $currentLocale['locale_name'],
'iso_code' => $currentLocale['iso_code'],
'name' => $currentLocale['name'],
'localized_name' => $currentLocale['localized_name'],
]);
}
$localeFilePath = base_path("lang/{$currentLocale['locale']}.json");
$localeFilePath = base_path("lang/{$currentLocale['locale_name']}.json");
$notifications = [];
$notificationsCount = count($notifications);