0

in my application I send some call on 10 process and I wait the response and if one of the call down or can not access the user whatever I want recall the user 3 times and I use it :

<?php

namespace App\Jobs;

use App\Library\Calling;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;

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

    public function handle () {
        $result = (new Calling)->Phone('xxx')->Call();

        /**
         * result is an array
         * - result['status'] => 1,2,3,4
         * 1 -> accepted
         * 2 -> rejected
         * 3 -> can not access the user
         * 4 -> error occurred
         */

        if ( in_array($result['status'], [1, 2]) ) {
            // in there job will be released
        } elseif ( in_array($result['status'], [3, 4]) ) {
            // in there it must recall after 3 seconds the user
            // and if the attempts count is 3 release the job
            // but how ?
        }
    }

}
Hanik
  • 317
  • 2
  • 6
  • 25
  • Not quite sure what you are asking @Hanik - do you have an error with something, or are you asking for someone to write your code for you, or is there something that is working strangely, or? – Watercayman Aug 05 '19 at 18:23
  • i asked that in this job when the result comes some status how can i redispacth the job or release the job ? ok ? – Hanik Aug 05 '19 at 19:06

0 Answers0