Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/260.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在laravel中添加用于广播通知的自定义专用频道_Php_Laravel_Laravel 5 - Fatal编程技术网

Php 在laravel中添加用于广播通知的自定义专用频道

Php 在laravel中添加用于广播通知的自定义专用频道,php,laravel,laravel-5,Php,Laravel,Laravel 5,广播工作,但它使用notifiable_类型作为频道名称和用户id。但如果我只想在后端api上更改某些模型在10个子文件夹内,该怎么办。我需要在任何地方改变前端的频道 从文档中,我发现: /** * The channels the user receives notification broadcasts on. * * @return string */ public function receivesBroadcastNotificationsOn() { return '

广播工作,但它使用notifiable_类型作为频道名称和用户id。但如果我只想在后端api上更改某些模型在10个子文件夹内,该怎么办。我需要在任何地方改变前端的频道

从文档中,我发现:

/**
 * The channels the user receives notification broadcasts on.
 *
 * @return string
 */
public function receivesBroadcastNotificationsOn()
{
    return 'users.'.$this->id;
}

但它不起作用,它仍然使用notifiable_类型作为频道名称。。如何更改此设置?

您可以为每个应报告实体指定任何自定义频道名称。因此,如果您使用用户模型:


如果您正在使用队列,请确保。

重新启动队列似乎完成了任务:Ddo您可能知道如何广播自定义数据,当我用数据广播阵列时,它还发送类型、套接字和uuid。我不想要那3个…你能提供更多关于你到底要去哪里的信息吗?有效负载接收到它或以何种方式自定义它。我发布了一个新问题:D我的意思是可能我需要uuid用于read_at,但显示我的应用程序/模型/用户类型:D有点愚蠢
# User.php

/**
 * The channels the user receives notification broadcasts on.
 *
 * @return string
 */
public function receivesBroadcastNotificationsOn()
{
    return 'users.'.$this->id;
}