我正在尝试在事件发生时在事件和侦听器中获取消息,但我没有收到消息。
我的控制器代码
public function usermeta()
{
$message = 'message';
$res = Event::fire(new webhooks($message));
dd($res);
}
我的活动代码
class webhooks extends Event
{
use SerializesModels;
public $message;
public function __construct($message)
{
//
$this->$message = $message;
}
public function broadcastOn()
{
return [];
}
}
听众
class webhookslistener implements ShouldQueue
{
protected $message;
public function __construct()
{
}
public function handle(webhooks $event)
{
Storage::put('Subscription.log', $event->message);
dd($event->message); //I want the message here
}
}