withTranslations()->create(); $category->load(['translations' => fn ($query) => $query->where('locale', 'de')]); $expected = $category->translations->first()->name; expect($category->localizedName())->toBe($expected); }); test('localizedName falls back to the id when no translation is loaded', function () { $category = Category::factory()->create(); expect($category->localizedName())->toBe('#'.$category->id); });