mercredi 11 octobre 2017

Queue job not pushed in laraval v5.4

I am working on queue jobs in laraval v5.4. Now I want to send an email to users through email later function. Below is my function that I am using

public static function singleEmailQueueJob(){
        for($i=1; $i<=2; $i++){
             $time = $i * 10; 
             $data['email'] = 'abc@gmail.com';
             $data['name'] = "Rizwan_$time";
             $data['subject'] = 'Queue Job Testing->'.$i;
             $data['verification_code'] = base64_encode($i.time());
             \Mail::later($time,'emails.password', $data, function ($m) use ($data) {
                $m->from(CommonHelper::$email_info['admin_email'],CommonHelper::$email_info['site_title']);
                $m->to($data['email'],$data['name']);
                $m->subject($data['email']);
            });
        }
        echo "Email send successfully";
    }

when I run this function i receive following error in exception

{"success":"false","message":"Only mailables may be queued."}

in .eve file i set

QUEUE_DRIVER=database

and in config/queue.php

'database' => [
            'driver' => 'database',
            'table' => 'jobs',
            'queue' => 'default',
            'retry_after' => 90,
        ],

I don't know that Where is the problem in code please help to solve this problem

Thanks in advance



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire