feat: complete comment history

This commit is contained in:
2026-08-18 12:46:51 -07:00
parent 68c6250160
commit 963abf10fb
11 changed files with 344 additions and 7 deletions
@@ -0,0 +1,20 @@
<?php
namespace App\Http\Controllers\Account;
use App\Http\Controllers\Controller;
use App\Models\Comment;
use Illuminate\Http\Request;
class CommentHistoryController extends Controller
{
public function index()
{
$comments = Comment::where('user_id', auth()->id())
->with(['tour', 'flight'])
->latest()
->paginate(10);
return view('account.comment-history', compact('comments'));
}
}
@@ -76,10 +76,15 @@ class RegisterPostRequest extends FormRequest
'unique:App\Models\User', 'unique:App\Models\User',
'ir_mobile:zero' 'ir_mobile:zero'
], ],
'password' => [ 'current_password' => [
'required',
'current_password',
],
'new_password' => [
'required', 'required',
'min:6', 'min:6',
'confirmed' 'confirmed',
], ],
'province_id' => [ 'province_id' => [
'nullable', 'nullable',
+5
View File
@@ -105,4 +105,9 @@ class User extends Authenticated
{ {
return $this->hasMany(Comment::class); return $this->hasMany(Comment::class);
} }
public function wishlists()
{
return $this->hasMany(Wishlist::class);
}
} }
+18
View File
@@ -8,3 +8,21 @@ if (!function_exists('getUserFullName')) {
return $user->first_name . ' ' . $user->last_name; return $user->first_name . ' ' . $user->last_name;
} }
} }
if (!function_exists('getFileUrl')) {
function getFileUrl(?int $fileId): ?string
{
if (!$fileId){
return null;
}
$file = \App\Models\File::find($fileId);
if (!$file) {
return null;
}
return asset('storage/' . $file->path);
}
}
View File
View File
View File
View File
@@ -0,0 +1,123 @@
@extends('account.layouts.app')
@section('title', 'نظرات من')
@section('account-content')
<div class="col-lg-9">
<div class="user-profile-wrapper">
<div class="user-profile-card">
<h4 class="user-profile-card-title">
نظرات من
</h4>
<div class="row mt-30">
@forelse($comments as $comment)
<div class="col-12 mb-4">
<div class="review-item">
<div class="review-item-content">
<div class="mb-2">
@if($comment->tour)
<span class="badge">
تور
</span>
@elseif($comment->flight)
<span class="badge">
پرواز
</span>
@endif
</div>
<h5>
@if($comment->tour)
{{ $comment->tour->title }}
@elseif($comment->flight)
{{ $comment->flight->title }}
@endif
</h5>
<p>
{{ $comment->comment }}
</p>
<small>
{{ $comment->created_at->format('Y/m/d') }}
</small>
</div>
</div>
</div>
@empty
<div class="col-12">
<div class="text-center py-5">
<i class="far fa-comment-alt fa-3x mb-3"></i>
<h5>
هنوز نظری ثبت نکرده‌اید.
</h5>
<p>
نظراتی که برای تورها یا پروازها ثبت کنید،
در این قسمت نمایش داده می‌شوند.
</p>
</div>
</div>
@endforelse
</div>
{{-- Pagination --}}
@if($comments->hasPages())
<div class="pagination-area my-4">
{{ $comments->links() }}
</div>
@endif
</div>
</div>
</div>
@endsection
+154
View File
@@ -0,0 +1,154 @@
@extends('account.layouts.app')
@section('title' , 'تنظیمات')
@section('account-content')
<div class="user-profile-wrapper">
@error('success')
<span class="text-success">{{ $message }}</span>
@enderror
<div class="col-lg-12 mb-4">
<div class="user-profile-card">
<h4 class="user-profile-card-title">بروزرسانی مشخصات پروفایل</h4>
<div class="user-profile-form">
<form action="{{ route('account.edit-profile.post') }}" method="POST">
@csrf
@method('PUT')
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label>نام </label>
<input type="text" name="first_name" class="form-control"
value="{{ old('first_name', $user->first_name) }}" placeholder="نام شما">
@error('first_name')
<span class="text-danger">
{{ $message }}
</span>
@enderror
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>نام خانوادگی</label>
<input type="text" name="last_name" class="form-control"
value="{{ old('last_name', $user->last_name) }}" placeholder="نام خانوادگی">
@error('last_name')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>ایمیل</label>
<input type="text" name="email" class="form-control"
value="{{ old('email', $user->email) }}" placeholder="ایمیل">
@error('email')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>موبایل</label>
<input type="text" name="mobile" class="form-control"
value="{{ old('mobile', $user->mobile) }}" placeholder="موبایل">
@error('mobile')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>استان</label>
<input type="text" name="province_id" class="form-control"
value="{{ old('user_province', $user->user_province) }}" placeholder="استان">
@error('user_province')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>شهر</label>
<input type="text" name="city_id" class="form-control"
value="{{ old('user_city', $user->user_city) }}" placeholder="شهر">
@error('user_city')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
</div>
<h4 class="user-profile-card-title">عوض کردن رمز عبور</h4>
<p class="text-muted mb-3">(اگر می‌خواهید رمز عبورتان را تغییر دهید، از این بخش اقدام کنید.)</p>
<div class="form-group">
<label>رمز عبور فعلی</label>
<input type="password" name="current_password" class="form-control"
placeholder="رمز عبور فعلی">
@error('current_password')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
<div class="form-group">
<label>رمز عبور جدید</label>
<input type="password" name="new_password" class="form-control"
placeholder="رمز عبور جدید">
@error('new_password')
<span class="text-danger">{{ $message }}</span>
@enderror
</div>
<div class="form-group">
<label>تکرار رمز عبور جدید</label>
<input type="password" name="new_password_confirmation" class="form-control"
placeholder="تکرار رمز عبور جدید">
</div>
</div>
<button type="submit" class="theme-btn mt-4">آپدیت مشخصات پروفایل <i class="far fa-user"></i>
</button>
</form>
</div>
</div>
</div>
{{-- <div class="col-lg-12">--}}
{{-- <div class="user-profile-card">--}}
{{-- <h4 class="user-profile-card-title">عوض کردن رمز عبور</h4>--}}
{{-- <div class="col-lg-12">--}}
{{-- <div class="user-profile-form">--}}
{{-- <form action="{{ route('account.edit-profile.post') }}" method="POST">--}}
{{-- @csrf--}}
{{-- @method('PUT')--}}
{{-- <div class="form-group">--}}
{{-- <label>رمز عبور فعلی</label>--}}
{{-- <input type="password" name="current_password" class="form-control"--}}
{{-- placeholder="رمز عبور فعلی">--}}
{{-- @error('current_password')--}}
{{-- <span class="text-danger">{{ $message }}</span>--}}
{{-- @enderror--}}
{{-- </div>--}}
{{-- <div class="form-group">--}}
{{-- <label>رمز عبور جدید</label>--}}
{{-- <input type="password" name="new_password" class="form-control"--}}
{{-- placeholder="رمز عبور جدید">--}}
{{-- @error('new_password')--}}
{{-- <span class="text-danger">{{ $message }}</span>--}}
{{-- @enderror--}}
{{-- </div>--}}
{{-- <div class="form-group">--}}
{{-- <label>تکرار رمز عبور جدید</label>--}}
{{-- <input type="password" name="new_password_confirmation" class="form-control"--}}
{{-- placeholder="تکرار رمز عبور جدید">--}}
{{-- </div>--}}
{{-- <button type="submit" class="theme-btn mt-4">عوض کردن رمز عبور <i class="far fa-key"></i>--}}
{{-- </button>--}}
{{-- </form>--}}
{{-- </div>--}}
{{-- </div>--}}
{{-- </div>--}}
{{-- </div>--}}
</div>
@endsection
+17 -5
View File
@@ -1,6 +1,7 @@
<?php <?php
use App\Http\Controllers\Account\BookingController; use App\Http\Controllers\Account\BookingController;
use App\Http\Controllers\Account\CommentHistoryController;
use App\Http\Controllers\Account\EditProfileController; use App\Http\Controllers\Account\EditProfileController;
use App\Http\Controllers\Account\ProfileController; use App\Http\Controllers\Account\ProfileController;
use App\Http\Controllers\Account\WishlistController; use App\Http\Controllers\Account\WishlistController;
@@ -34,15 +35,26 @@ Route::prefix('account')->name('account.')->middleware('auth')->group(function (
Route::get('profile', [ProfileController::class, 'index'])->name('profile'); Route::get('profile', [ProfileController::class, 'index'])->name('profile');
Route::get('booking', [BookingController::class, 'index'])->name('booking');
Route::get('wishlist', [WishlistController::class, 'index'])->name('wishlist');
Route::prefix('edit-profile')->name('edit-profile.')->controller(EditProfileController::class)->group(function () { Route::prefix('edit-profile')->name('edit-profile.')->controller(EditProfileController::class)->group(function () {
Route::get('/', 'index')->name('index'); Route::get('/', 'index')->name('index');
Route::post('/', 'post')->name('post');
Route::put('/', 'post')->name('post');
}); });
Route::get('booking', [BookingController::class, 'index'])->name('booking');
Route::get('wishlist', [WishlistController::class, 'index'])
->name('wishlist');
Route::get(
'wishlist/{type}/{id}',
[WishlistController::class, 'toggle']
)->name('wishlist.toggle');
Route::get('comments', [CommentHistoryController::class, 'index'])
->name('comments');
}); });