feat:compele comments for dashboard side
This commit is contained in:
@@ -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();
|
$data = $request->validated();
|
||||||
|
|
||||||
Comment::create([
|
Comment::create([
|
||||||
|
|
||||||
'tour_id' => $tour->id,
|
'tour_id' => $tour->id,
|
||||||
'user_id' => auth()->id(),
|
'user_id' => auth()->id(),
|
||||||
'guest_name' => auth()->guest() ? $data['guest_name'] : null,
|
'guest_name' => auth()->guest() ? $data['guest_name'] : null,
|
||||||
@@ -41,5 +42,7 @@ class CommentController extends Controller
|
|||||||
|
|
||||||
return back()->with('success', 'نظر شما ثبت شد.');
|
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">
|
<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>
|
<span class="far fa-shopping-bag"></span>
|
||||||
اکنون رزرو کن
|
اکنون رزرو کن
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user