我创建了受保护的$ companyID;在我的工作类,然后在__construct
功能我传递了一个$id
但是当我尝试实例变量在我handler function
其null
如何实例化您在Laravel构造函数中传递的变量作业
protected $companyID = NULL;
public function __construct($ID) {
$this->companyID = $ID;
}
然后实例化类的时候?
$ProcessOutgoingSMS = new ProcessOutgoingSMS();
$ProcessOutgoingSMS->dispatch(3);
看看THI链接https://laracasts.com/discuss/channels/general-discussion/how-do-you-pass-constructor-parameters-when-youre-instantiating-an-interface-through-a-bind –