_reply_list 中使用分页通知如何定位到回复的位置

在6.1节中,topic.show显示reply_list并没有使用分页
resources/views/topics/index.blade.php

.
.
.
<div class="panel panel-default topic-reply">
                <div class="panel-body">
                    @includeWhen(Auth::check(),'topics._reply_box',['topic' => $topic])
                    @include('topics._reply_list',['replies' => $topic->replies()->with('user')->get()])
                </div>
</div>
.
.
.

我把这个列表显示加上了分页

.
.
.
<div class="panel panel-default topic-reply">
                <div class="panel-body">
                    @includeWhen(Auth::check(),'topics._reply_box',['topic' => $topic])
                    @include('topics._reply_list',['replies' => $topic->replies()->with('user')->paginate(5)])
                </div>
</div>
.
.
.

resources/views/topics/_reply_list.blade.php

<div class="reply_list">
    @foreach($replies as $reply)
        <div class="media" name="reply{{ $reply->id }}" id="reply{{ $reply->id }}">
            <div class="avatar pull-left">
                <a href="{{ route('users.show', [$reply->user_id]) }}">
                    <img class="media-object img-thumbnail" alt="{{ $reply->user->name }}"
                         src="{{ $reply->user->avatar }}"
                         style="width:48px;height:48px;"/>
                </a>
            </div>
            <div class="infos">
                <div class="media-heading">
                    <a href="{{ route('users.show', [$reply->user_id]) }}" title="{{ $reply->user->name }}">
                        {{ $reply->user->name }}
                    </a>
                    <span> • </span>
                    <span class="meta" title="{{ $reply->created_at }}">{{ $reply->created_at->diffForHumans() }}</span>

                    @can('destroy',$reply)
                        <span class="meta pull-right">
                        <form action="{{ route('replies.destroy',$reply->id) }}" method="post">
                            {{ csrf_field() }}
                            {{ method_field('DELETE') }}
                            <button type="submit" class="btn btn-default btn-xs pull-left">
                                <i class="glyphicon glyphicon-trash"></i>
                            </button>
                        </form>
                        </span>
                    @endcan
                </div>
                <div class="reply-content">
                    {!! $reply->content !!}
                </div>
            </div>
        </div>
        <hr>
    @endforeach
    {!! $replies->render() !!}
</div>

分页很简单的就实现了,但是在通知内容中的这个$url
app/Notifications/TopicReplied.php

.
.
.
public function toMail($notifiable)
    {
        $url = $this->reply->topic->link(['#reply' . $this->reply->id]);

        return (new MailMessage)
            ->line('您的话题有新回复!')
            ->action('查看回复', $url);
    }
.
.
.

这里的#reply . $this->reply->id是用来在页面中定位评论内容的位置的,如果使用分页的话,如果通知的评论已经不在第一页了,那不是就定位不到了吗?我想问下大家是怎么解决这个问题的。

《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!