chore: finalize project updates

This commit is contained in:
2026-08-22 11:42:16 +03:30
parent 7719d750e9
commit 691290c340
55 changed files with 1923 additions and 6498 deletions
@@ -17,7 +17,7 @@ class CommentController extends Controller
$tour->comments()->create([
'user_id' => auth()->id(),
'body' => $request->validated('body'),
'status' => 1, // در انتظار تایید (طبق قرارداد: 1 = پیشنویس/فعال، 2 = منتشرشده)
'status' => 1,
]);
return back()->with('success', 'نظر شما با موفقیت ثبت شد.');
@@ -15,7 +15,7 @@ class FavoriteController extends Controller
$user = Auth::user();
$favorites = Favorite::with('favoritable') // لود پلیمورفیک
$favorites = Favorite::with('favoritable')
->where('user_id', $user->id)
->orderByDesc('id')
->paginate(9);
@@ -23,10 +23,6 @@ class FavoriteController extends Controller
return view('account.favorites', compact('favorites'));
}
/**
* افزودن/حذف به صورت toggle (اگر موجود بود حذف کن، اگر نبود بساز).
* این متد با پلیمورفیک بودن Favorite از هر دو مدل تور و پرواز پشتیبانی میکنه.
*/
public function toggle(Request $request)
{
// چک اینکه کاربر ورود شدهست
@@ -42,7 +38,7 @@ class FavoriteController extends Controller
$type = $data['favoritable_type'];
$id = $data['favoritable_id'];
// بررسی اینکه مدل درخواستی واقعاً وجود داره (مثلاً Tour یا Flight)
if (!class_exists($type)) {
return back()->with('error', 'مدل معتبر نیست');
}