diff --git a/src/Http/Controllers/Auth/PasswordResetLinkController.php b/src/Http/Controllers/Auth/PasswordResetLinkController.php index 90e91aa..1f12fe5 100644 --- a/src/Http/Controllers/Auth/PasswordResetLinkController.php +++ b/src/Http/Controllers/Auth/PasswordResetLinkController.php @@ -21,8 +21,9 @@ public function create(): Response public function store(Request $request): RedirectResponse { + $connection = config('translations.database_connection'); $request->validate([ - 'email' => 'required|email|exists:ltu_contributors,email', + 'email' => 'required|email|exists:'.($connection ? $connection.'.' : '').'ltu_contributors,email', ]); $token = Str::random(); @@ -30,7 +31,8 @@ public function store(Request $request): RedirectResponse $user = Contributor::firstWhere('email', $request->email); if ($user) { - cache(["password.reset.$user->id" => $token], + cache( + ["password.reset.$user->id" => $token], now()->addMinutes(60) ); diff --git a/src/Http/Controllers/ContributorController.php b/src/Http/Controllers/ContributorController.php index c506902..8e2ef87 100644 --- a/src/Http/Controllers/ContributorController.php +++ b/src/Http/Controllers/ContributorController.php @@ -36,9 +36,10 @@ public function create(): Modal public function store(Request $request): RedirectResponse { + $connection = config('translations.database_connection'); $request->validate([ 'role' => 'required|integer', - 'email' => 'required|email|unique:ltu_contributors,email', + 'email' => 'required|email|unique:'.($connection ? $connection.'.' : '').'ltu_contributors,email', ]); do { diff --git a/src/Http/Controllers/ProfileController.php b/src/Http/Controllers/ProfileController.php index cb8901c..29d5e94 100644 --- a/src/Http/Controllers/ProfileController.php +++ b/src/Http/Controllers/ProfileController.php @@ -21,9 +21,10 @@ public function edit(Request $request): Response public function update(Request $request): RedirectResponse { + $connection = config('translations.database_connection'); $request->validate([ 'name' => ['required', 'max:255'], - 'email' => ['required', 'string', 'lowercase', 'email', 'max:255', 'unique:ltu_contributors,email,'.$request->user()->id], + 'email' => ['required', 'string', 'lowercase', 'email', 'max:255', 'unique:'.($connection ? $connection.'.' : '').'ltu_contributors,email,'.$request->user()->id], ]); $request->user()->update($request->only('name', 'email')); diff --git a/src/Http/Controllers/SourcePhraseController.php b/src/Http/Controllers/SourcePhraseController.php index 3e89cd7..dbe95d1 100644 --- a/src/Http/Controllers/SourcePhraseController.php +++ b/src/Http/Controllers/SourcePhraseController.php @@ -76,9 +76,10 @@ public function create(): Modal public function store(Request $request): RedirectResponse { + $connection = config('translations.database_connection'); $request->validate([ 'key' => ['required', 'regex:/^[\w. ]+$/u'], - 'file' => ['required', 'integer', 'exists:ltu_translation_files,id'], + 'file' => ['required', 'integer', 'exists:'.($connection ? $connection.'.' : '').'ltu_translation_files,id'], 'content' => ['required', 'string'], ]); @@ -111,10 +112,11 @@ public function edit(Phrase $phrase): Response|RedirectResponse public function update(Phrase $phrase, Request $request): RedirectResponse { + $connection = config('translations.database_connection'); $request->validate([ 'note' => 'nullable|string', 'phrase' => 'required|string', - 'file' => 'required|integer|exists:ltu_translation_files,id', + 'file' => 'required|integer|exists:'.($connection ? $connection.'.' : '').'ltu_translation_files,id', ]); $phrase->update([