2015-02-05 21:41:00 -06:00
|
|
|
<?php
|
2017-12-10 02:02:26 -06:00
|
|
|
/**
|
|
|
|
* TransactionCurrencySeeder.php
|
|
|
|
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
|
|
|
*
|
|
|
|
* This file is part of Firefly III.
|
|
|
|
*
|
|
|
|
* Firefly III is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Firefly III is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2017-12-17 07:43:34 -06:00
|
|
|
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
2017-12-10 02:02:26 -06:00
|
|
|
*/
|
2017-03-25 07:41:17 -05:00
|
|
|
declare(strict_types=1);
|
2015-02-05 21:41:00 -06:00
|
|
|
|
2015-02-05 22:01:24 -06:00
|
|
|
use FireflyIII\Models\TransactionCurrency;
|
2015-02-11 00:35:10 -06:00
|
|
|
use Illuminate\Database\Seeder;
|
|
|
|
|
2015-02-05 21:41:00 -06:00
|
|
|
/**
|
|
|
|
* Class TransactionCurrencySeeder
|
|
|
|
*/
|
|
|
|
class TransactionCurrencySeeder extends Seeder
|
|
|
|
{
|
|
|
|
public function run()
|
|
|
|
{
|
2018-01-15 10:13:23 -06:00
|
|
|
$currencies = [];
|
2017-11-18 14:03:28 -06:00
|
|
|
// european currencies
|
2018-11-10 03:04:46 -06:00
|
|
|
$currencies[] = ['code' => 'EUR', 'name' => 'Euro', 'symbol' => '€', 'decimal_places' => 2,'enabled' => 1];
|
2018-01-15 10:13:23 -06:00
|
|
|
$currencies[] = ['code' => 'HUF', 'name' => 'Hungarian forint', 'symbol' => 'Ft', 'decimal_places' => 2];
|
|
|
|
$currencies[] = ['code' => 'GBP', 'name' => 'British Pound', 'symbol' => '£', 'decimal_places' => 2];
|
2018-03-01 14:20:04 -06:00
|
|
|
$currencies[] = ['code' => 'UAH', 'name' => 'Ukrainian hryvnia', 'symbol' => '₴', 'decimal_places' => 2];
|
|
|
|
$currencies[] = ['code' => 'PLN', 'name' => 'Polish złoty', 'symbol' => 'zł', 'decimal_places' => 2];
|
|
|
|
$currencies[] = ['code' => 'TRY', 'name' => 'Turkish lira', 'symbol' => '₺', 'decimal_places' => 2];
|
2017-11-18 14:03:28 -06:00
|
|
|
|
|
|
|
// american currencies
|
2018-01-15 10:13:23 -06:00
|
|
|
$currencies[] = ['code' => 'USD', 'name' => 'US Dollar', 'symbol' => '$', 'decimal_places' => 2];
|
|
|
|
$currencies[] = ['code' => 'BRL', 'name' => 'Brazilian real', 'symbol' => 'R$', 'decimal_places' => 2];
|
|
|
|
$currencies[] = ['code' => 'CAD', 'name' => 'Canadian dollar', 'symbol' => 'C$', 'decimal_places' => 2];
|
2017-11-18 14:03:28 -06:00
|
|
|
|
|
|
|
// oceanian currencies
|
2018-01-15 10:13:23 -06:00
|
|
|
$currencies[] = ['code' => 'IDR', 'name' => 'Indonesian rupiah', 'symbol' => 'Rp', 'decimal_places' => 2];
|
|
|
|
$currencies[] = ['code' => 'AUD', 'name' => 'Australian dollar', 'symbol' => 'A$', 'decimal_places' => 2];
|
|
|
|
$currencies[] = ['code' => 'NZD', 'name' => 'New Zealand dollar', 'symbol' => 'NZ$', 'decimal_places' => 2];
|
2017-11-18 14:03:28 -06:00
|
|
|
|
|
|
|
// african currencies
|
2018-01-15 10:13:23 -06:00
|
|
|
$currencies[] = ['code' => 'EGP', 'name' => 'Egyptian pound', 'symbol' => 'E£', 'decimal_places' => 2];
|
|
|
|
$currencies[] = ['code' => 'MAD', 'name' => 'Moroccan dirham', 'symbol' => 'DH', 'decimal_places' => 2];
|
|
|
|
$currencies[] = ['code' => 'ZAR', 'name' => 'South African rand', 'symbol' => 'R', 'decimal_places' => 2];
|
2017-11-18 14:03:28 -06:00
|
|
|
|
|
|
|
// asian currencies
|
2018-01-15 10:13:23 -06:00
|
|
|
$currencies[] = ['code' => 'JPY', 'name' => 'Japanese yen', 'symbol' => '¥', 'decimal_places' => 2];
|
|
|
|
$currencies[] = ['code' => 'RMB', 'name' => 'Chinese yuan', 'symbol' => '元', 'decimal_places' => 2];
|
|
|
|
$currencies[] = ['code' => 'RUB', 'name' => 'Russian ruble ', 'symbol' => '₽', 'decimal_places' => 2];
|
2018-05-03 00:26:09 -05:00
|
|
|
$currencies[] = ['code' => 'INR', 'name' => 'Indian rupee', 'symbol' => '₹', 'decimal_places' => 2];
|
2017-11-18 14:03:28 -06:00
|
|
|
|
|
|
|
// international currencies
|
2018-01-15 10:13:23 -06:00
|
|
|
$currencies[] = ['code' => 'XBT', 'name' => 'Bitcoin', 'symbol' => '₿', 'decimal_places' => 8];
|
|
|
|
$currencies[] = ['code' => 'BCH', 'name' => 'Bitcoin cash', 'symbol' => '₿C', 'decimal_places' => 8];
|
|
|
|
$currencies[] = ['code' => 'ETH', 'name' => 'Ethereum', 'symbol' => 'Ξ', 'decimal_places' => 12];
|
|
|
|
|
2018-09-22 23:57:50 -05:00
|
|
|
// PLEASE ADD NEW CURRENCIES BELOW THIS LINE
|
|
|
|
$currencies[] = ['code' => 'ILS', 'name' => 'Israeli new shekel', 'symbol' => '₪', 'decimal_places' => 2];
|
2018-11-01 09:15:49 -05:00
|
|
|
$currencies[] = ['code' => 'CHF', 'name' => 'Swiss franc', 'symbol' => 'CHF', 'decimal_places' => 2];
|
2018-12-31 10:53:13 -06:00
|
|
|
$currencies[] = ['code' => 'HRK', 'name' => 'Croatian kuna', 'symbol' => 'kn', 'decimal_places' => 2];
|
2018-09-22 23:57:50 -05:00
|
|
|
|
2018-01-15 10:13:23 -06:00
|
|
|
foreach ($currencies as $currency) {
|
|
|
|
try {
|
|
|
|
TransactionCurrency::create($currency);
|
|
|
|
} catch (PDOException $e) {
|
2018-12-21 23:07:57 -06:00
|
|
|
Log::info(sprintf('Could not create transaction currency "%s". It might exist already.', $currency['code']));
|
2018-01-15 10:13:23 -06:00
|
|
|
}
|
|
|
|
}
|
2015-02-05 21:41:00 -06:00
|
|
|
}
|
2017-11-15 03:53:17 -06:00
|
|
|
}
|