-
Notifications
You must be signed in to change notification settings - Fork 131
/
_comment.blade.php
71 lines (69 loc) · 2.71 KB
/
_comment.blade.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
@php
/**
* @var \App\Models\Comment $comment
*/
@endphp
<div id="comment-{{ $comment->id }}" class="media">
<div class="media-body rounded-lg p-2 {{ $loop->last ? '' : 'mb-3' }}">
<h5 class="mt-0 mb-1">
<div class="d-flex justify-content-between">
<div>
<a href="{{ getCommentLink($comment) }}" class="small">#</a>
{{ $comment->user->name }}
@if ($comment->isReply())
<span class="small">
<span class="text-lowercase">{{ __('comment.replied_to') }}</span>
{{ $comment->parent->user->name }}
<a href="{{ getCommentLink($comment->parent) }}">#</a>
</span>
@endif
</div>
<div class="text-muted small">{{ $comment->created_at->diffForHumans() }}</div>
</div>
</h5>
@if ($comment->isReply())
<div class="border my-2">
<div class="small text-muted ms-2">{{ $comment->parent->content }}</div>
</div>
@endif
<div class="my-2">{{ $comment->content }}</div>
<div>
@can('reply', $comment)
<button
data-bs-toggle="modal"
data-bs-target="#reply-modal-{{ $comment->id }}"
class="btn btn-sm btn-link text-uppercase p-0 me-2">
{{ __('comment.reply') }}
</button>
@endcan
@can('update', $comment)
<button data-bs-toggle="modal"
data-bs-target="#comment-modal-{{ $comment->id }}"
class="btn btn-sm btn-link text-uppercase p-0 me-2">
{{ __('comment.edit') }}
</button>
@endcan
@can('delete', $comment)
<a href="{{ route('comments.destroy', $comment) }}"
class="btn btn-sm btn-link text-danger text-uppercase p-0"
data-confirm="Are you sure?"
data-method="delete"
rel="nofollow">
{{ __('comment.delete') }}
</a>
@endcan
</div>
@can('update', $comment)
@include('components.comment._modal', [
'modalTitle' => 'comment.edit_comment',
'comment' => $comment,
'method' => 'PUT',
'content' => $comment->content,
'submitLabel' => 'comment.update',
])
@endcan
@can('reply', $comment)
@include('components.comment.reply._modal')
@endcan
</div>
</div>