$language], ['language' => ['required', Rule::in(self::$supportedLanguages)]] ); $validated = $validator->validated(); // Save the language preference in the session $request->session()->put(['language' => $validated['language']]); return redirect()->back(); } }