Nicer translation

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2025-04-22 14:22:58 +01:00
parent e5dc13e48c
commit 473c684fa5
2 changed files with 5 additions and 2 deletions

View file

@ -48,12 +48,14 @@ class ManufacturersController extends Controller
{ {
$this->authorize('index', Manufacturer::class); $this->authorize('index', Manufacturer::class);
if (Manufacturer::withTrashed()->count() == 0) { $manufacturers_count = Manufacturer::withTrashed()->count();
if ($manufacturers_count == 0) {
Artisan::call('db:seed', ['--class' => 'ManufacturerSeeder']); Artisan::call('db:seed', ['--class' => 'ManufacturerSeeder']);
return redirect()->route('manufacturers.index')->with('success', trans('general.seeding.manufacturers.success')); return redirect()->route('manufacturers.index')->with('success', trans('general.seeding.manufacturers.success'));
} }
return redirect()->route('manufacturers.index')->with('error', 'could not seed - manufacturers already exist'); return redirect()->route('manufacturers.index')->with('error', trans_choice('general.seeding.manufacturers.error', ['count' => $manufacturers_count]));
} }
/** /**

View file

@ -620,6 +620,7 @@ return [
'button' => 'Create Manufacturers', 'button' => 'Create Manufacturers',
'prompt' => 'You do not have any manufacturers yet. Would you like to seed a list of common manufacturers? (THIS WILL OVERWRITE EXISTING MANUFACTURERS, including those that have been soft-deleted.)', 'prompt' => 'You do not have any manufacturers yet. Would you like to seed a list of common manufacturers? (THIS WILL OVERWRITE EXISTING MANUFACTURERS, including those that have been soft-deleted.)',
'success' => 'Manufacturers seeded successfully', 'success' => 'Manufacturers seeded successfully',
'error' => 'Could not seed manufacturers. A manufacturer record already exists and seeding would overwrite it.|Could not seed manufacturers. :count manufacturer records already exist and seeding would overwrite them.',
], ],
], ],