git commit "add comments and fix tour comments display"

This commit is contained in:
2026-08-17 13:33:37 +03:30
parent 970786ae94
commit 902384625b
11 changed files with 729 additions and 166 deletions
+86
View File
@@ -102,6 +102,92 @@
{{ $tour->description }}
</p>
<div>
<span>تعداد مشاهده</span>
<strong>
{{ $tour->views ?? 0 }}
بازدید
</strong>
</div>
</div>
<form action="{{ route('users.comments.store') }}" method="POST">
@csrf
<input
type="hidden"
name="tour_id"
value="{{ $tour->id }}"
>
<div class="mb-3">
<label>
امتیاز
</label>
<select name="rating" class="form-control">
<option value="5">★★★★★</option>
<option value="4">★★★★</option>
<option value="3">★★★</option>
<option value="2">★★</option>
<option value="1">★</option>
</select>
</div>
<div class="mb-3">
<label>
نظر شما
</label>
<textarea
name="comment"
rows="5"
class="form-control"
></textarea>
</div>
<button class="btn btn-primary">
ثبت نظر
</button>
</form>
<div class="comments-list mt-5">
<h3 class="mb-4">
نظرات کاربران
</h3>
@forelse($comments as $comment)
<div class="card p-4 mb-3 shadow-sm">
<div class="d-flex justify-content-between">
<strong>
{{ $comment->user->name }}
</strong>
<small>
{{ $comment->created_at->diffForHumans() }}
</small>
</div>
<p class="mt-3 mb-0">
{{ $comment->comment }}
</p>
</div>
@empty
<div class="alert alert-secondary">
هنوز نظری ثبت نشده است.
</div>
@endforelse
</div>