2015-02-06 04:41:00 +01:00
|
|
|
<?php
|
2022-12-29 19:43:43 +01:00
|
|
|
|
2017-12-10 09:02:26 +01:00
|
|
|
/**
|
|
|
|
|
* TransactionTypeSeeder.php
|
2020-03-17 16:06:30 +00:00
|
|
|
* Copyright (c) 2019 james@firefly-iii.org.
|
2017-12-10 09:02:26 +01:00
|
|
|
*
|
2019-10-02 06:38:38 +02:00
|
|
|
* This file is part of Firefly III (https://github.com/firefly-iii).
|
2017-12-10 09:02:26 +01:00
|
|
|
*
|
2019-10-02 06:38:38 +02:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
* License, or (at your option) any later version.
|
2017-12-10 09:02:26 +01:00
|
|
|
*
|
2019-10-02 06:38:38 +02:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2017-12-10 09:02:26 +01:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2019-10-02 06:38:38 +02:00
|
|
|
* GNU Affero General Public License for more details.
|
2017-12-10 09:02:26 +01:00
|
|
|
*
|
2019-10-02 06:38:38 +02:00
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2017-12-10 09:02:26 +01:00
|
|
|
*/
|
2017-03-25 13:41:17 +01:00
|
|
|
declare(strict_types=1);
|
2016-05-20 08:57:45 +02:00
|
|
|
|
2020-11-02 06:20:49 +01:00
|
|
|
namespace Database\Seeders;
|
|
|
|
|
|
2015-02-06 05:01:24 +01:00
|
|
|
use FireflyIII\Models\TransactionType;
|
2015-02-11 07:35:10 +01:00
|
|
|
use Illuminate\Database\Seeder;
|
|
|
|
|
|
2015-02-06 04:41:00 +01:00
|
|
|
/**
|
2020-03-17 16:06:30 +00:00
|
|
|
* Class TransactionTypeSeeder.
|
2015-02-06 04:41:00 +01:00
|
|
|
*/
|
|
|
|
|
class TransactionTypeSeeder extends Seeder
|
|
|
|
|
{
|
2023-11-04 11:31:14 +01:00
|
|
|
public function run(): void
|
2015-02-06 04:41:00 +01:00
|
|
|
{
|
2018-01-15 17:13:23 +01:00
|
|
|
$types = [
|
|
|
|
|
TransactionType::WITHDRAWAL,
|
|
|
|
|
TransactionType::DEPOSIT,
|
|
|
|
|
TransactionType::TRANSFER,
|
|
|
|
|
TransactionType::OPENING_BALANCE,
|
2018-01-25 18:55:31 +01:00
|
|
|
TransactionType::RECONCILIATION,
|
2021-03-21 09:15:40 +01:00
|
|
|
TransactionType::INVALID,
|
2022-03-29 15:01:12 +02:00
|
|
|
TransactionType::LIABILITY_CREDIT,
|
2018-01-15 17:13:23 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
foreach ($types as $type) {
|
2024-05-27 05:08:44 +02:00
|
|
|
if (null === TransactionType::where('type', $type)->first()) {
|
2024-05-26 15:36:30 +02:00
|
|
|
try {
|
|
|
|
|
TransactionType::create(['type' => $type]);
|
|
|
|
|
} catch (\PDOException $e) {
|
|
|
|
|
// @ignoreException
|
|
|
|
|
}
|
2018-01-15 17:13:23 +01:00
|
|
|
}
|
|
|
|
|
}
|
2015-02-06 04:41:00 +01:00
|
|
|
}
|
2017-11-15 10:53:17 +01:00
|
|
|
}
|