<?php
namespace App\Jobs\Admin;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use App\Model\CustomerModel;
class DispatchNoPurposeCustomerJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $customers;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($customers)
{
$this->customers = $customers;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$customers = $this->customers;
}
}
当队列处理器处理的时,抛出错误:ErrorException: Undefined property: App\Jobs\Admin\DispatchCustomerJob::$customer in D:\epiboly\telemarketing\app\Jobs\Admin\DispatchCustomerJob.php:35 Stack trace:
那是因为没有显性定义protected $customers,各位童学们别跟我一样偷懒哦!