我創建了受保護的$ 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 –