mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-22 12:11:19 +00:00
Skip creation using if statement.
This commit is contained in:
@@ -71,10 +71,12 @@ class TransactionCurrencySeeder extends Seeder
|
||||
$currencies[] = ['code' => 'HRK', 'name' => 'Croatian kuna', 'symbol' => 'kn', 'decimal_places' => 2];
|
||||
|
||||
foreach ($currencies as $currency) {
|
||||
try {
|
||||
TransactionCurrency::create($currency);
|
||||
} catch (\PDOException $e) {
|
||||
// @ignoreException
|
||||
if(null === TransactionCurrency::where('code', $currency['code'])->first()) {
|
||||
try {
|
||||
TransactionCurrency::create($currency);
|
||||
} catch (\PDOException $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user