mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-14 00:04:24 +00:00
Schedule recurring transactions daily.
This commit is contained in:
@@ -25,12 +25,11 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Console;
|
namespace FireflyIII\Console;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use FireflyIII\Events\AdminRequestedTestMessage;
|
||||||
use FireflyIII\Jobs\CreateRecurringTransactions;
|
use FireflyIII\Jobs\CreateRecurringTransactions;
|
||||||
use FireflyIII\Models\RecurrenceRepetition;
|
use FireflyIII\User;
|
||||||
use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
|
|
||||||
use Illuminate\Console\Scheduling\Schedule;
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||||
use Log;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File to make sure commnds work.
|
* File to make sure commnds work.
|
||||||
@@ -65,41 +64,17 @@ class Kernel extends ConsoleKernel
|
|||||||
*/
|
*/
|
||||||
protected function schedule(Schedule $schedule): void
|
protected function schedule(Schedule $schedule): void
|
||||||
{
|
{
|
||||||
|
// create recurring transactions.
|
||||||
|
$schedule->job(new CreateRecurringTransactions(new Carbon))->daily();
|
||||||
|
|
||||||
|
// send test email.
|
||||||
$schedule->call(
|
$schedule->call(
|
||||||
function () {
|
function () {
|
||||||
// run for the entirety of 2018, just to see what happens
|
$ipAddress = '127.0.0.1';
|
||||||
$start = new Carbon('2018-01-01');
|
/** @var User $user */
|
||||||
$end = new Carbon('2018-12-31');
|
$user = User::find(1);
|
||||||
while ($start <= $end) {
|
event(new AdminRequestedTestMessage($user, $ipAddress));
|
||||||
Log::info(sprintf('Now at %s', $start->format('D Y-m-d')));
|
|
||||||
$job = new CreateRecurringTransactions(clone $start);
|
|
||||||
$job->handle();
|
|
||||||
$start->addDay();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
)->everyMinute();
|
)->daily();
|
||||||
|
|
||||||
//$schedule->job(new CreateRecurringTransactions(new Carbon))->everyMinute();
|
|
||||||
|
|
||||||
//$schedule->job(new CreateRecurringTransactions(new Carbon))->everyMinute();
|
|
||||||
|
|
||||||
|
|
||||||
// $schedule->call(
|
|
||||||
// function () {
|
|
||||||
// // command to do something
|
|
||||||
// Log::debug('Schedule creation of transactions yaay!');
|
|
||||||
// }
|
|
||||||
// )->daily();
|
|
||||||
//
|
|
||||||
// $schedule->call(
|
|
||||||
// function () {
|
|
||||||
// // command to do something
|
|
||||||
// Log::debug('Every minute!');
|
|
||||||
// }
|
|
||||||
// )->everyMinute()
|
|
||||||
// ->emailOutputTo('thege');
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user