3d269c0261
- Changed the scheduling frequency of the FetchCurrencyRates job from hourly to every minute. - Added FetchGoldRates and MergeCurrencyAndGoldRates jobs to the schedule, ensuring they also run every minute. - Introduced a new method `runScheduledCommands` to encapsulate the scheduling logic for better organization and maintainability. This commit enhances the application's ability to fetch and merge financial data in a timely manner.
51 lines
1.4 KiB
PHP
51 lines
1.4 KiB
PHP
<?php
|
||
|
||
namespace App\Console;
|
||
|
||
use Illuminate\Console\Scheduling\Schedule;
|
||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||
use App\Jobs\FetchCurrencyRates;
|
||
use App\Jobs\FetchGoldRates;
|
||
use App\Jobs\MergeCurrencyAndGoldRates;
|
||
|
||
class Kernel extends ConsoleKernel
|
||
{
|
||
/**
|
||
* Define the application's command schedule.
|
||
*
|
||
* These should be classes that implement the ShouldQueue interface.
|
||
*
|
||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||
* @return void
|
||
*/
|
||
protected function schedule(Schedule $schedule)
|
||
{
|
||
$schedule->job(new FetchCurrencyRates())->everyMinute();
|
||
$schedule->job(new FetchGoldRates())->everyMinute();
|
||
$schedule->job(new MergeCurrencyAndGoldRates())->everyMinute();
|
||
}
|
||
|
||
/**
|
||
* Register the commands for your application.
|
||
*
|
||
* @return void
|
||
*/
|
||
protected function commands()
|
||
{
|
||
$this->load(__DIR__.'/Commands');
|
||
|
||
require base_path('routes/console.php');
|
||
}
|
||
|
||
public function runScheduledCommands()
|
||
{
|
||
$schedule = app(Schedule::class);
|
||
$schedule->job(new FetchCurrencyRates())->everyMinute();
|
||
$schedule->job(new FetchGoldRates())->everyMinute();
|
||
$schedule->job(new MergeCurrencyAndGoldRates())->everyMinute();
|
||
|
||
// Diğer job'larınızı buraya ekleyin
|
||
|
||
$schedule->run();
|
||
}
|
||
}
|