Skip to content

Commit 5b1ee94

Browse files
authored
bigfix: translation detail throws an error (#167)
1 parent 58f1435 commit 5b1ee94

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/Http/Controllers/PhraseController.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ public function index(Translation $translation, Request $request): Response|Redi
6262
->paginate($request->input('perPage') ?? 12)
6363
->withQueryString();
6464

65+
$translation = $translation
66+
->withCount('phrases')
67+
->withProgress()
68+
->where('id', $translation->id)
69+
->first();
70+
6571
return Inertia::render('phrases/index', [
6672
'phrases' => PhraseResource::collection($phrases),
6773
'translation' => TranslationResource::make($translation),
@@ -81,10 +87,18 @@ public function edit(Translation $translation, Phrase $phrase): RedirectResponse
8187
return redirect()->route('ltu.source_translation.edit', $phrase->uuid);
8288
}
8389

90+
$translation = $translation
91+
->withCount('phrases')
92+
->withProgress()
93+
->where('id', $translation->id)
94+
->first();
95+
8496
return Inertia::render('phrases/edit', [
8597
'phrase' => PhraseResource::make($phrase),
8698
'translation' => TranslationResource::make($translation),
87-
'source' => TranslationResource::make(Translation::where('source', true)?->first()),
99+
'source' => TranslationResource::make(Translation::isSource()
100+
->withCount('phrases')
101+
->withProgress()?->first()),
88102
'similarPhrases' => PhraseResource::collection($phrase->similarPhrases()),
89103
'suggestedTranslations' => [
90104
'google' => [

0 commit comments

Comments
 (0)