CheckDictionariesChange.php 754 Bytes
<?php
namespace App\Service\Requests\Direct;

use App\Jobs\ProcessCallLimitedAPI;
use App\Service\API\API;
use App\Service\Requests\APIRequest;
use App\Service\Requests\DirectRequest;

class CheckDictionariesChange extends DirectRequest {
    protected $next;

    function call($next = null, $response = null){
        $this->next = $next;
        $this->requestPrepare($response);
        $process = new ProcessCallLimitedAPI($this);
        dispatch($process)->onQueue('limits');
    }

    function handle($response){
        if ($this->next){
            $this->next->call(null, $response);
        }
    }

    private function requestPrepare($response){
        $this->setService('changes');
        $this->setMethod('checkDictionaries');
    }
}