firefly-iii/database/seeds/TransactionTypeSeeder.php

50 lines
1.5 KiB
PHP
Raw Normal View History

2015-02-05 21:41:00 -06:00
<?php
2017-12-10 02:02:26 -06:00
/**
* TransactionTypeSeeder.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);
2016-05-20 01:57:45 -05:00
2015-02-05 22:01:24 -06:00
use FireflyIII\Models\TransactionType;
2015-02-11 00:35:10 -06:00
use Illuminate\Database\Seeder;
2015-02-05 21:41:00 -06:00
/**
* Class TransactionTypeSeeder
*/
class TransactionTypeSeeder extends Seeder
{
public function run()
{
2018-01-15 10:13:23 -06:00
$types = [
TransactionType::WITHDRAWAL,
TransactionType::DEPOSIT,
TransactionType::TRANSFER,
TransactionType::OPENING_BALANCE,
2018-01-25 11:55:31 -06:00
TransactionType::RECONCILIATION,
2018-01-15 10:13:23 -06:00
];
foreach ($types as $type) {
try {
TransactionType::create(['type' => $type]);
} catch (PDOException $e) {
Log::warning(sprintf('Could not create transaction type "%s". It might exist already.', $type));
}
}
2015-02-05 21:41:00 -06:00
}
2017-11-15 03:53:17 -06:00
}