<?php

namespace App\Console\Commands;

use App\Models\ApiKey\ApikeyModel;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;

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

    public function handle()
    {
        // بروزرسانی مقدار apikey با استفاده از متود generateApiKey
        $currentDateTime = Carbon::now();
        $currentDateTime = (int)($currentDateTime->getTimestamp()  / 3600);
        ApikeyModel::query()->update(['apikey' => md5(sha1("shayan"))]);
    }
}
