<?php
namespace App\Jobs;
use App\User;
use App\Jobs\Job;
use Illuminate\Contracts\Mail\Mailer;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Bus\Queueable;\\延时任务delay()需要加载
class SendReminderEmail extends Job implements ShouldQueue
{
use InteractsWithQueue, SerializesModels , Queueable;
public function handle(Mailer $mailer)
{
echo 'ceshi';
}
}
调用
public function subtract_store($order_id = 392)
{
$job = (new AddSubtractStore($order_id))->delay(5);
$this->dispatch($job);
}