Php 您如何使用laravel slack通知api来监视(@)处于空闲状态的人?

Php 您如何使用laravel slack通知api来监视(@)处于空闲状态的人?,php,laravel-5.6,slack-api,Php,Laravel 5.6,Slack Api,我有一个功能正常的通知系统,可以发布到我们公司的频道。然而,遇到的一切都只是文本。假设在内容中查找/链接用户名。我看到它被设置为“1”,但在频道中显示时没有影响 namespace App\Notifications; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Notification; use Illuminate\Notifi

我有一个功能正常的通知系统,可以发布到我们公司的频道。然而,遇到的一切都只是文本。假设在内容中查找/链接用户名。我看到它被设置为“1”,但在频道中显示时没有影响

 namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Messages\SlackMessage;
class Dd extends Notification
{
use Queueable;

/**
 * Create a new notification instance.
 *
 * @return void
 */
public function __construct()
{
    //
}

/**
 * Get the notification's delivery channels.
 *
 * @param  mixed  $notifiable
 * @return array
 */
public function via($notifiable)
{
    return ['slack'];
}


/**
 * Get the array representation of the notification.
 *
 * @param  mixed  $notifiable
 * @return array
 */
public function toArray($notifiable)
{
    return [
        //
    ];
}

/**
 * Get the Slack representation of the notification.
 *
 * @param  mixed  $notifiable
 * @return SlackMessage
 */
public function toSlack($slackComment)
{   
    $slackMessage = new SlackMessage();
    $slackMessage->linkNames();
    $slackMessage->from('Christopher');
    $slackMessage->to($slackComment->channel);
    $slackMessage->content("Harded coded for example @christopher <- this doesn't get linked to the user in slack but should");
     $slackMessage->info();
    //dd($slackMessage); // this shows that the linkedNames attribute has been set to "1"
    return $slackMessage;             
}
名称空间应用程序\通知;
使用照明\总线\可排队;
使用Illumb\Contracts\Queue\ShouldQueue;
使用照明\通知\通知;
使用Illumb\Notifications\Messages\SlackMessage;
类Dd扩展了通知
{
使用可排队;
/**
*创建一个新的通知实例。
*
*@返回无效
*/
公共函数构造()
{
//
}
/**
*获取通知的传递通道。
*
*@param混合$应呈报
*@return数组
*/
公共职能通过($notifiable)
{
返回['slack'];
}
/**
*获取通知的数组表示形式。
*
*@param混合$应呈报
*@return数组
*/
公共职能toArray($Notified)
{
返回[
//
];
}
/**
*获取通知的松弛表示形式。
*
*@param混合$应呈报
*@returnslackmessage
*/
公共函数toSlack($slackComment)
{   
$slackMessage=新slackMessage();
$slackMessage->linkNames();
$slackMessage->from('Christopher');
$slackMessage->to($slackComment->channel);
$slackMessage->content(“硬编码,例如@christopher

若要在应用程序中提及用户发布的文本,您需要提供他们的 以下语法中的用户ID:

Hey <@U024BE7LH>, thanks for submitting your report.
嘿,谢谢你提交报告。

谢谢@ceejayoz-我花了一段时间才意识到有多个api,用于发送消息的Webhook和用于获取频道/用户信息的api等等……似乎默认的laravel slack通知程序只提供对Webhook的访问(?)