Laravel Slack Webhook URL 在哪里定义
Where is Laravel Slack Webhook URL defined
继续我的 Laravel 5.5 项目,我对您在 Laravel 应用程序中定义 slack webhook URL 的位置感到困惑。
https://laravel.com/docs/5.5/notifications#routing-slack-notifications 显示在 User
(或任何 notifiable
模型)上定义一个 routeNotificationForSlack
方法 returns $this->slack_webhook_url
-- 但是该 var 从未被填充:
class User extends Authenticatable
{
use Notifiable;
public function routeNotificationForSlack()
{
return $this->slack_webhook_url;
}
slack_webhook_url
应该在这个模型中硬编码,还是在实例化通知时传入?
如何实现由你决定 routeNotificationForSlack()
,Laravel 只会调用它并使用 return 值来确定要 ping 的 url。
如果您的所有用户共享相同的 webhook 端点,您可以将其存储在 .env
中,如果每个用户的端点不同,return 数据库列(如示例)。如果它依赖于group/privilege,你应该相应地实现它
继续我的 Laravel 5.5 项目,我对您在 Laravel 应用程序中定义 slack webhook URL 的位置感到困惑。
https://laravel.com/docs/5.5/notifications#routing-slack-notifications 显示在 User
(或任何 notifiable
模型)上定义一个 routeNotificationForSlack
方法 returns $this->slack_webhook_url
-- 但是该 var 从未被填充:
class User extends Authenticatable
{
use Notifiable;
public function routeNotificationForSlack()
{
return $this->slack_webhook_url;
}
slack_webhook_url
应该在这个模型中硬编码,还是在实例化通知时传入?
如何实现由你决定 routeNotificationForSlack()
,Laravel 只会调用它并使用 return 值来确定要 ping 的 url。
如果您的所有用户共享相同的 webhook 端点,您可以将其存储在 .env
中,如果每个用户的端点不同,return 数据库列(如示例)。如果它依赖于group/privilege,你应该相应地实现它