feat:compele comments for dashboard side

This commit is contained in:
2026-08-18 12:41:56 +03:30
parent bee7587f2c
commit d6e3b20557
4 changed files with 121 additions and 1 deletions
@@ -0,0 +1,27 @@
<?php
namespace App\Http\Controllers\Account;
use App\Http\Controllers\Controller;
use App\Models\Comment;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class CommentStatusController extends Controller
{
public function index()
{
$comments = Comment::with([
'flight.departureAirport.city',
'flight.arrivalAirport.city',
'tour',
])
->where('user_id', Auth::id())
->latest()
->paginate(10);
return view('account.comments', compact('comments'));
}
}
@@ -31,6 +31,7 @@ class CommentController extends Controller
$data = $request->validated();
Comment::create([
'tour_id' => $tour->id,
'user_id' => auth()->id(),
'guest_name' => auth()->guest() ? $data['guest_name'] : null,
@@ -41,5 +42,7 @@ class CommentController extends Controller
return back()->with('success', 'نظر شما ثبت شد.');
}
}
@@ -0,0 +1,90 @@
@extends('account.layouts.app')
@section('title', 'نظرات من')
@section('account-content')
<div class="user-profile-wrapper">
<div class="col-lg-12 mb-4">
<div class="user-profile-card">
<h4 class="user-profile-card-title">
نظرات من
</h4>
@forelse($comments as $comment)
<div class="border-bottom py-4">
<div class="d-flex justify-content-between">
<div>
@if($comment->flight)
<h5>
نظر درباره پرواز
</h5>
<p>
{{ $comment->flight->departureAirport->city->name }}
<i class="far fa-exchange"></i>
{{ $comment->flight->arrivalAirport->city->name }}
</p>
@elseif($comment->tour)
<h5>
نظر درباره تور
</h5>
<p>
{{ $comment->tour->title }}
</p>
@endif
</div>
</div>
<p class="mt-3">
{{ $comment->comment }}
</p>
@if($comment->created_at)
<small class="text-muted">
{{ $comment->created_at->toJalali()->format('Y/m/d') }}
</small>
@endif
</div>
@empty
<div class="text-center py-5">
<p>
هنوز نظری ثبت نکرده‌اید.
</p>
</div>
@endforelse
<div class="mt-4">
{{ $comments->links() }}
</div>
</div>
</div>
</div>
@endsection
@@ -97,7 +97,7 @@
<div class="listing-side-btn mt-3">
<a href="#" class="theme-btn">
<a href="{{route('account.booking')}}" class="theme-btn">
<span class="far fa-shopping-bag"></span>
اکنون رزرو کن
</a>