1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-27 13:00:23 +08:00
koogua 0336a54911 1.源文件增加版权信息
2.群组状态和课程协同
2021-06-13 15:49:47 +08:00

37 lines
1.1 KiB
PHP

<?php
/**
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.koogua.com
*/
namespace App\Services\Logic\Notice\System;
use App\Models\Comment as CommentModel;
use App\Models\Notification as NotificationModel;
use App\Models\User as UserModel;
use App\Services\Logic\Service as LogicService;
class CommentLiked extends LogicService
{
public function handle(CommentModel $comment, UserModel $sender)
{
$commentContent = kg_substr($comment->content, 0, 32);
$notification = new NotificationModel();
$notification->sender_id = $sender->id;
$notification->receiver_id = $comment->owner_id;
$notification->event_id = $comment->id;
$notification->event_type = NotificationModel::TYPE_COMMENT_LIKED;
$notification->event_info = [
'sender' => ['id' => $sender->id, 'name' => $sender->name],
'comment' => ['id' => $comment->id, 'content' => $commentContent],
];
$notification->create();
}
}