<?php

namespace App\Jobs;

use App\Http\helper\HttpCurl;
use App\Models\AccountsInfo;
use App\Models\PrivateMail;
use App\Services\FirstPayStatService;
use App\Services\OrderServices;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;

class ClearCache implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    public function handle()
    {
        $servers = json_decode(env('WEB_SERVERS'), true) ?: [];
        foreach ($servers as $server) {
            $host = $server['host'];
            $curl = new HttpCurl();
            $curl->curl_get($host . '/api/clear_cache');
        }
    }
}
