gitea_issues_exporter/app/Console/Kernel.php

52 lines
1.5 KiB
PHP

<?php
namespace App\Console;
use App\Console\Commands\exportCsv;
use App\Console\Commands\exportCsvCli;
use App\Http\Controllers\GiteaApiController\GiteaExport;
use Dotenv\Dotenv;
use Illuminate\Console\Scheduling\Schedule;
use Laravel\Lumen\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
exportCsv::class,
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->call(function () {
$firstDay = date('Y-m-01'); // First day of the current month
$lastDay = date('Y-m-t'); // Last day of the current month
$calculate_agent_cost = true;
$third_party_integrations_allow = true;
$third_party_integrations_nextcloud = true;
$third_party_integrations_open_project = false;
$email_send_allow = true;
$gitea_export = new GiteaExport(
$calculate_agent_cost,
$third_party_integrations_allow,
$third_party_integrations_nextcloud,
$third_party_integrations_open_project,
$email_send_allow,
);
$gitea_export->export_issues($firstDay, $lastDay, ['state' => 'closed']);
})->monthly();
}
}