ManagementSystem/BACKEND/app/Console/Commands/DailyAPICall.php

27 lines
726 B
PHP

<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;
class DailyAPICall extends Command
{
protected $signature = 'daily:api-call';
protected $description = 'Call API daily and store results';
public function handle()
{
// Gọi API
$response = Http::get(env('APP_URL').'/api/v1/admin/jira/send-worklog-report');
// Xử lý dữ liệu và lưu vào cơ sở dữ liệu (ví dụ)
// $data = $response->json();
// Nếu cần lưu dữ liệu vào database, bạn có thể sử dụng Eloquent
// Ghi log hoặc thông báo khi cần thiết
$this->info('API called successfully!');
}
}