2015-02-06 04:41:00 +01:00
|
|
|
<?php
|
2016-02-05 15:01:33 +01:00
|
|
|
declare(strict_types = 1);
|
|
|
|
/**
|
|
|
|
* TestDataSeeder.php
|
2016-04-01 16:46:11 +02:00
|
|
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
2016-02-05 15:01:33 +01:00
|
|
|
*
|
|
|
|
* This software may be modified and distributed under the terms
|
|
|
|
* of the MIT license. See the LICENSE file for details.
|
|
|
|
*/
|
2016-01-16 09:15:24 +01:00
|
|
|
|
2016-01-20 09:15:33 +01:00
|
|
|
use Carbon\Carbon;
|
2016-04-28 10:59:36 +02:00
|
|
|
use FireflyIII\Events\BudgetLimitStored;
|
2016-04-25 11:44:41 +02:00
|
|
|
use FireflyIII\Models\BudgetLimit;
|
2016-01-30 07:36:11 +01:00
|
|
|
use FireflyIII\Support\Migration\TestData;
|
2015-02-11 07:35:10 +01:00
|
|
|
use Illuminate\Database\Seeder;
|
2015-02-06 04:41:00 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class TestDataSeeder
|
|
|
|
*/
|
|
|
|
class TestDataSeeder extends Seeder
|
|
|
|
{
|
2016-02-05 15:01:33 +01:00
|
|
|
/** @var Carbon */
|
|
|
|
public $end;
|
2016-01-24 20:38:58 +01:00
|
|
|
/** @var Carbon */
|
|
|
|
public $start;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* TestDataSeeder constructor.
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
2016-02-05 15:01:33 +01:00
|
|
|
$this->start = Carbon::create()->subYears(2)->startOfYear();
|
|
|
|
$this->end = Carbon::now();
|
2016-01-24 20:38:58 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-02-06 04:41:00 +01:00
|
|
|
/**
|
2016-01-16 09:15:24 +01:00
|
|
|
* Run the database seeds.
|
2015-06-29 15:23:50 +02:00
|
|
|
*
|
2016-01-16 09:15:24 +01:00
|
|
|
* @return void
|
2015-02-06 04:41:00 +01:00
|
|
|
*/
|
|
|
|
public function run()
|
|
|
|
{
|
2016-01-24 16:05:14 +01:00
|
|
|
|
2016-02-05 15:01:33 +01:00
|
|
|
$current = clone $this->start;
|
|
|
|
while ($current < $this->end) {
|
|
|
|
$month = $current->format('F Y');
|
2016-01-20 10:47:29 +01:00
|
|
|
|
2016-02-05 15:01:33 +01:00
|
|
|
$current->addMonth();
|
|
|
|
}
|
2016-01-20 10:47:29 +01:00
|
|
|
}
|
2015-03-29 08:14:32 +02:00
|
|
|
}
|