git commit "add user reservations and complete profile features"

This commit is contained in:
2026-08-17 19:35:22 +03:30
parent ded7416302
commit 3055e42641
12 changed files with 829 additions and 0 deletions
@@ -0,0 +1,36 @@
<?php
namespace App\Http\Controllers;
use App\Models\Reservation;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class ReservationController extends Controller
{
public function index()
{
$reservations = Reservation::
where('user_id', Auth::id())
->latest()
->get();
return view('account.users.Reservation.index', compact('reservations'));
}
public function store(Request $request)
{
Reservation::create([
'user_id' => Auth::id(),
'reservable_id' => $request->reservable_id,
'reservable_type' => $request->reservable_type,
'price' => $request->price,
'status' => 'pending'
]);
return redirect()->route('users.reservations.index')->with('success','رزرو شما ثبت شد.'); }
}
+7
View File
@@ -76,6 +76,13 @@ class Flight extends Model
{
return $this->morphMany(Favorite::class, 'favoritable');
}
public function reservations()
{
return $this->morphMany(
Reservation::class,
'reservable'
);
}
#[Scope]
public function applySearch(Builder $query, array $filters): void
+60
View File
@@ -0,0 +1,60 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
/**
* Class Reservation
*
* @property int $id
* @property int $user_id
* @property int $reservable_id
* @property string $reservable_type
* @property float $price
* @property string $status
* @property Carbon $created_at
* @property Carbon $updated_at
*
* @package App\Models
*/
class Reservation extends Model
{
protected $table = 'reservations';
public static $snakeAttributes = false;
protected $casts = [
'user_id' => 'int',
'reservable_id' => 'int',
'price' => 'float',
];
protected $fillable = [
'user_id',
'reservable_id',
'reservable_type',
'price',
'status'
];
public function user()
{
return $this->belongsTo(User::class);
}
public function reservable()
{
return $this->morphTo();
}
}
+4
View File
@@ -66,4 +66,8 @@ class Tour extends Model
{
return $this->morphMany(Favorite::class, 'favoritable');
}
public function reservations()
{
return $this->morphMany(Reservation::class, 'reservable');
}
}
+481
View File
@@ -0,0 +1,481 @@
-- phpMyAdmin SQL Dump
-- version 5.2.3
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Aug 17, 2026 at 04:03 PM
-- Server version: 8.4.7
-- PHP Version: 8.3.28
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `airline_agency`
--
-- --------------------------------------------------------
--
-- Table structure for table `admins`
--
DROP TABLE IF EXISTS `admins`;
CREATE TABLE IF NOT EXISTS `admins` (
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
`first_name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`last_name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`username` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`mobile` varchar(15) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`image` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`status` tinyint NOT NULL DEFAULT '1' COMMENT 'Status: Inactive=0, Active=1, Blocked=2',
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`),
UNIQUE KEY `email` (`email`),
UNIQUE KEY `mobile` (`mobile`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `admin_roles`
--
DROP TABLE IF EXISTS `admin_roles`;
CREATE TABLE IF NOT EXISTS `admin_roles` (
`admin_id` bigint UNSIGNED NOT NULL,
`role_id` bigint UNSIGNED NOT NULL,
PRIMARY KEY (`admin_id`,`role_id`),
KEY `fk_admin_roles_role` (`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `cities`
--
DROP TABLE IF EXISTS `cities`;
CREATE TABLE IF NOT EXISTS `cities` (
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
`province_id` bigint UNSIGNED NOT NULL,
`name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NOT NULL,
`updated_at` timestamp NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `comments`
--
DROP TABLE IF EXISTS `comments`;
CREATE TABLE IF NOT EXISTS `comments` (
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
`user_id` bigint UNSIGNED NOT NULL,
`tour_id` bigint UNSIGNED DEFAULT NULL,
`flight_id` bigint UNSIGNED DEFAULT NULL,
`rating` tinyint NOT NULL,
`comment` text COLLATE utf8mb4_unicode_ci,
`status` tinyint NOT NULL DEFAULT '0' COMMENT 'Status: 0=Pending, 1=Approved, 2=Rejected',
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `tour_id` (`tour_id`),
KEY `user_id` (`user_id`),
KEY `comments_ibfk_3` (`flight_id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `comments`
--
INSERT INTO `comments` (`id`, `user_id`, `tour_id`, `flight_id`, `rating`, `comment`, `status`, `created_at`, `updated_at`) VALUES
(3, 4, NULL, 1, 4, 'سیشبلنلسیمکو', 0, '2026-08-17 09:20:36', '2026-08-17 09:20:36'),
(4, 4, NULL, 1, 5, 'شسیبلات', 0, '2026-08-17 09:20:41', '2026-08-17 09:20:41'),
(5, 4, NULL, 1, 5, 'sdsafsgdhfjg', 0, '2026-08-17 09:23:55', '2026-08-17 09:23:55'),
(6, 4, NULL, 1, 5, 'sadgflkak', 0, '2026-08-17 09:24:00', '2026-08-17 09:24:00'),
(7, 4, NULL, 2, 5, 'ضقاابتفغط', 0, '2026-08-17 09:25:46', '2026-08-17 09:25:46'),
(8, 4, NULL, 2, 5, 'afjhjafljnagd', 0, '2026-08-17 09:27:38', '2026-08-17 09:27:38'),
(9, 4, NULL, 2, 5, NULL, 0, '2026-08-17 09:27:42', '2026-08-17 09:27:42'),
(10, 4, NULL, 1, 5, 'سشلتقفظن', 0, '2026-08-17 09:33:02', '2026-08-17 09:33:02'),
(11, 4, NULL, 2, 5, 'یلاظیتفف', 0, '2026-08-17 09:33:15', '2026-08-17 09:33:15'),
(12, 4, 2, NULL, 5, 'شیبلیبلئا', 0, '2026-08-17 09:36:16', '2026-08-17 09:36:16'),
(13, 4, 2, NULL, 5, 'بسعااااااااااابت', 0, '2026-08-17 09:37:07', '2026-08-17 09:37:07'),
(14, 4, 2, NULL, 5, 'ضصقثایتلبازل', 0, '2026-08-17 10:18:41', '2026-08-17 10:18:41'),
(15, 4, 3, NULL, 2, 'dfbffngfx', 0, '2026-08-17 12:06:47', '2026-08-17 12:06:47'),
(16, 4, 2, NULL, 5, 'سیینمسسسسس', 0, '2026-08-17 14:37:48', '2026-08-17 14:37:48');
-- --------------------------------------------------------
--
-- Table structure for table `favorites`
--
DROP TABLE IF EXISTS `favorites`;
CREATE TABLE IF NOT EXISTS `favorites` (
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
`user_id` bigint UNSIGNED NOT NULL,
`favoritable_type` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`favoritable_id` bigint UNSIGNED NOT NULL,
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `unique_favorite` (`user_id`,`favoritable_type`,`favoritable_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `favorites`
--
INSERT INTO `favorites` (`id`, `user_id`, `favoritable_type`, `favoritable_id`, `created_at`) VALUES
(1, 4, 'App\\Models\\Tour', 2, '2026-08-17 10:11:01'),
(2, 4, 'App\\Models\\Tour', 3, '2026-08-17 10:46:14'),
(3, 4, 'App\\Models\\Tour', 1, '2026-08-17 10:48:29');
-- --------------------------------------------------------
--
-- Table structure for table `files`
--
DROP TABLE IF EXISTS `files`;
CREATE TABLE IF NOT EXISTS `files` (
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`extension` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
`size` bigint UNSIGNED NOT NULL,
`original_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`path` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NOT NULL,
`updated_at` timestamp NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `flights`
--
DROP TABLE IF EXISTS `flights`;
CREATE TABLE IF NOT EXISTS `flights` (
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
`airline` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`flight_number` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`origin` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`destination` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`departure_date` date DEFAULT NULL,
`departure_time` time DEFAULT NULL,
`arrival_time` time DEFAULT NULL,
`flight_class` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`capacity` int DEFAULT NULL,
`price` decimal(10,2) DEFAULT NULL,
`image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`views` int NOT NULL,
`status` tinyint DEFAULT NULL COMMENT 'Status: 0=Draft, 1=Active, 2=Inactive, 3=Finished, 4=Cancelled',
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `flights`
--
INSERT INTO `flights` (`id`, `airline`, `flight_number`, `origin`, `destination`, `departure_date`, `departure_time`, `arrival_time`, `flight_class`, `capacity`, `price`, `image`, `views`, `status`, `created_at`, `updated_at`) VALUES
(1, 'ایران ایر', 'IR123', 'تهران', 'مشهد', '2026-08-20', '08:30:00', '10:00:00', 'Economy', 150, 2500000.00, 'assets/img/side_banners/flight/1.jpg', 50, 1, '2026-08-17 04:29:53', '2026-08-17 15:06:16'),
(2, 'کیش ایر', 'QR450', 'تهران', 'دوحه', '2026-09-05', '18:00:00', '20:30:00', 'Business', 100, 12000000.00, 'assets/img/side_banners/flight/3.jpg', 31, 1, '2026-08-17 04:32:47', '2026-08-17 15:56:33');
-- --------------------------------------------------------
--
-- Table structure for table `permissions`
--
DROP TABLE IF EXISTS `permissions`;
CREATE TABLE IF NOT EXISTS `permissions` (
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`slug` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uq_permissions_name` (`name`),
UNIQUE KEY `uq_permissions_slug` (`slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `provinces`
--
DROP TABLE IF EXISTS `provinces`;
CREATE TABLE IF NOT EXISTS `provinces` (
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `provinces`
--
INSERT INTO `provinces` (`id`, `name`, `created_at`, `updated_at`) VALUES
(1, 'مازندران', NULL, NULL),
(2, 'تهران', NULL, NULL),
(3, 'گلستان', NULL, NULL),
(4, 'گیلان', NULL, NULL),
(5, 'مشهد', NULL, NULL);
-- --------------------------------------------------------
--
-- Table structure for table `reservations`
--
DROP TABLE IF EXISTS `reservations`;
CREATE TABLE IF NOT EXISTS `reservations` (
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
`user_id` bigint UNSIGNED NOT NULL,
`reservable_id` bigint UNSIGNED NOT NULL,
`reservable_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`price` int NOT NULL,
`status` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT 'pending',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `reservations_user_id_foreign` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `reservations`
--
INSERT INTO `reservations` (`id`, `user_id`, `reservable_id`, `reservable_type`, `price`, `status`, `created_at`, `updated_at`) VALUES
(1, 4, 2, 'App\\Models\\Tour', 4500000, 'pending', '2026-08-17 15:45:04', '2026-08-17 15:45:04'),
(2, 4, 2, 'App\\Models\\Tour', 4500000, 'pending', '2026-08-17 15:45:08', '2026-08-17 15:45:08'),
(3, 4, 2, 'App\\Models\\Tour', 4500000, 'pending', '2026-08-17 15:45:50', '2026-08-17 15:45:50'),
(4, 4, 2, 'App\\Models\\Tour', 4500000, 'pending', '2026-08-17 15:50:47', '2026-08-17 15:50:47'),
(5, 4, 2, 'App\\Models\\Flight', 12000000, 'pending', '2026-08-17 15:56:38', '2026-08-17 15:56:38');
-- --------------------------------------------------------
--
-- Table structure for table `roles`
--
DROP TABLE IF EXISTS `roles`;
CREATE TABLE IF NOT EXISTS `roles` (
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`slug` varchar(15) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NOT NULL,
`updated_at` timestamp NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`),
UNIQUE KEY `slug` (`slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `role_permissions`
--
DROP TABLE IF EXISTS `role_permissions`;
CREATE TABLE IF NOT EXISTS `role_permissions` (
`role_id` bigint UNSIGNED NOT NULL,
`permission_id` bigint UNSIGNED NOT NULL,
PRIMARY KEY (`role_id`,`permission_id`),
KEY `fk_role_permissions_permission` (`permission_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `settings`
--
DROP TABLE IF EXISTS `settings`;
CREATE TABLE IF NOT EXISTS `settings` (
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
`code` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
`value` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NOT NULL,
`updated_at` timestamp NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `tours`
--
DROP TABLE IF EXISTS `tours`;
CREATE TABLE IF NOT EXISTS `tours` (
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
`title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`summary` text COLLATE utf8mb4_unicode_ci NOT NULL,
`description` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`travel_type_id` tinyint UNSIGNED NOT NULL,
`price` decimal(12,2) NOT NULL,
`views` int NOT NULL,
`departure_date` date NOT NULL,
`status` tinyint NOT NULL COMMENT 'Draft=0|Active=1|Inactive=2|Finished=3||Cancelled=4',
`created_at` timestamp NOT NULL,
`updated_at` timestamp NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `tours`
--
INSERT INTO `tours` (`id`, `title`, `summary`, `description`, `image`, `travel_type_id`, `price`, `views`, `departure_date`, `status`, `created_at`, `updated_at`) VALUES
(2, 'تور 7 روزه مشهد', 'سفر زیارتی به مشهد مقدس با هتل 4 ستاره', 'تور کامل مشهد شامل اقامت، ترانسفر و خدمات گردشگری', 'assets/img/exp-page/slider/1.jpg', 1, 4500000.00, 32, '2026-08-20', 1, '2026-08-17 07:13:38', '2026-08-17 15:50:42'),
(3, 'تور کیش 5 روزه', 'تور تفریحی کیش با هتل نزدیک دریا', 'سفر به جزیره کیش همراه با اقامت و خدمات ویژه', 'assets/img/tours/kish.jpg', 2, 6500000.00, 4, '2026-09-05', 1, '2026-08-17 07:13:38', '2026-08-17 12:07:54'),
(4, 'تور استانبول 6 روزه', 'تور خارجی استانبول با پرواز رفت و برگشت', 'اقامت در هتل، ترانسفر فرودگاهی و گشت شهری', 'assets/img/tours/istanbul.jpg', 2, 18500000.00, 1, '2026-09-15', 1, '2026-08-17 07:13:38', '2026-08-17 09:04:24'),
(5, 'تور شمال 3 روزه', 'سفر طبیعت گردی به شمال ایران', 'اقامت در ویلا و بازدید از جاذبه های گردشگری شمال', 'assets/img/tours/north.jpg', 1, 2800000.00, 0, '2026-08-28', 1, '2026-08-17 07:13:38', '2026-08-17 07:13:38');
-- --------------------------------------------------------
--
-- Table structure for table `tour_flights`
--
DROP TABLE IF EXISTS `tour_flights`;
CREATE TABLE IF NOT EXISTS `tour_flights` (
`id` bigint NOT NULL AUTO_INCREMENT,
`tour_id` bigint NOT NULL,
`flight_id` bigint NOT NULL,
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `tour_id` (`tour_id`),
KEY `flight_id` (`flight_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `travel_types`
--
DROP TABLE IF EXISTS `travel_types`;
CREATE TABLE IF NOT EXISTS `travel_types` (
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`status` tinyint NOT NULL DEFAULT '1' COMMENT 'Status: 0=Inactive, 1=Active',
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
CREATE TABLE IF NOT EXISTS `users` (
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
`first_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`last_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`national_code` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
`gender` tinyint NOT NULL COMMENT 'male:0 | famale:1',
`marital_status` tinyint NOT NULL COMMENT 'single:0|Married:1|Separated:2',
`spouse_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`mobile` varchar(11) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`profile_image` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`username` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
`province_id` bigint UNSIGNED DEFAULT NULL,
`city_id` bigint UNSIGNED DEFAULT NULL,
`status` tinyint NOT NULL COMMENT 'Draft=0|Active=1|Inactive=2|Expired=3|Cancelled=4',
`created_at` timestamp NOT NULL,
`updated_at` timestamp NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`),
UNIQUE KEY `email` (`email`),
KEY `city_id` (`city_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `first_name`, `last_name`, `national_code`, `gender`, `marital_status`, `spouse_name`, `mobile`, `email`, `profile_image`, `username`, `password`, `province_id`, `city_id`, `status`, `created_at`, `updated_at`) VALUES
(1, 'حاتمه', 'اندرزا', '2081391694', 1, 0, NULL, '09119533286', 'hatame@gmail.com', NULL, 'hatame14', '$2y$12$6OqCJMCgK3I3bckMWzVFse8xmHcsaIzqAE/GULjX74iT.FoZjqaJO', NULL, NULL, 0, '2026-08-16 05:18:26', '2026-08-16 05:18:26'),
(2, 'شهرزاد', 'زندی', '2080706640', 1, 0, NULL, '09112345678', 'shahrzad@gmail.com', NULL, 'shahrzad', '$2y$12$X5fVgkc3d/aYaLnDl6g3lOp5vjJiB0ZEl.1eepjr2e34DnuZQ9fZa', NULL, NULL, 0, '2026-08-16 05:56:30', '2026-08-16 05:56:30'),
(3, 'مینا', 'اسمعیلی', '2011093232', 1, 1, 'مهدی', '09013921486', 'mina@gmail.com', NULL, 'mina14', '$2y$12$7MKYeFaQi0PC1g8q4jQYSe6mVMpPrmGMPLsKvHVVq6Q2Q7Xx4a6qe', NULL, NULL, 0, '2026-08-16 06:38:10', '2026-08-16 06:38:10'),
(4, 'فاطمه', 'اندرزا', '2081391695', 0, 1, 'معصومه', '09119533285', 'admin@gmail.com', '1786946484.jpg', 'admin15', '$2y$12$3yreH4aox9WNZNzYF2NudeSEJIUt578EpzSck3BNCr1r5dLtku02i', 3, NULL, 0, '2026-08-17 06:01:24', '2026-08-17 15:40:12');
--
-- Constraints for dumped tables
--
--
-- Constraints for table `admin_roles`
--
ALTER TABLE `admin_roles`
ADD CONSTRAINT `fk_admin_roles_admin` FOREIGN KEY (`admin_id`) REFERENCES `admins` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `fk_admin_roles_role` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `comments`
--
ALTER TABLE `comments`
ADD CONSTRAINT `comments_ibfk_1` FOREIGN KEY (`tour_id`) REFERENCES `tours` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
ADD CONSTRAINT `comments_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
--
-- Constraints for table `favorites`
--
ALTER TABLE `favorites`
ADD CONSTRAINT `favorites_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
--
-- Constraints for table `reservations`
--
ALTER TABLE `reservations`
ADD CONSTRAINT `reservations_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
--
-- Constraints for table `role_permissions`
--
ALTER TABLE `role_permissions`
ADD CONSTRAINT `fk_role_permissions_permission` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `fk_role_permissions_role` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `users`
--
ALTER TABLE `users`
ADD CONSTRAINT `users_ibfk_1` FOREIGN KEY (`city_id`) REFERENCES `cities` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
@@ -55,6 +55,13 @@
</a>
</li>
<li>
<a href="{{route('users.reservations.index')}}">
<i class="fa fa-reservations"></i>
رزرو من
</a>
</li>
</ul>
@@ -0,0 +1,155 @@
@extends('layouts.app')
@section('content')
<div class="theme-page-section theme-page-section-lg">
<div class="container">
<div class="row">
<div class="col-md-3">
@include('account.layout.app')
</div>
<div class="col-md-9">
<div class="account-content">
<h2 class="account-title">
رزروهای من ✈️
</h2>
@if($reservations->count())
<div class="favorite-list">
@foreach($reservations as $reservation)
<div class="favorite-card">
<div class="favorite-info">
@if($reservation->reservable_type == 'App\Models\Tour')
<h3>
{{ $reservation->reservable?->title ?? 'تور حذف شده' }}
</h3>
<p>
تور
</p>
@elseif($reservation->reservable_type == 'App\Models\Flight')
<h3>
{{ $reservation->reservable?->name ?? 'پرواز حذف شده' }}
</h3>
<p>
پرواز
</p>
@endif
<p>
مبلغ:
<strong>
{{ number_format($reservation->price) }}
تومان
</strong>
</p>
<p>
وضعیت:
@if($reservation->status == 'pending')
<span class="badge bg-warning">
در انتظار بررسی
</span>
@elseif($reservation->status == 'confirmed')
<span class="badge bg-success">
تایید شده
</span>
@elseif($reservation->status == 'cancelled')
<span class="badge bg-danger">
لغو شده
</span>
@endif
</p>
</div>
</div>
@endforeach
</div>
@else
<div class="empty-favorite">
<i class="fa fa-plane"></i>
<p>
هنوز رزروی ثبت نکرده‌اید.
</p>
</div>
@endif
</div>
</div>
</div>
</div>
</div>
@endsection
@@ -54,6 +54,22 @@
</div>
<div class="col-md-4">
<div class="card border-0 shadow-sm rounded-4 p-3">
<h5>
رزرو✈️
</h5>
<strong>
{{ auth()->user()->reservations()->count() }}
</strong>
</div>
</div>
</div>
+27
View File
@@ -483,6 +483,33 @@
<span>قیمت</span>
<b>{{ number_format($flight->price) }} تومان</b>
</div>
<div class="mt-4">
@auth
<form action="{{ route('users.reservations.store') }}" method="POST">
@csrf
<input type="hidden" name="reservable_id" value="{{ $flight->id }}">
<input type="hidden" name="reservable_type" value="App\Models\Flight">
<input type="hidden" name="price" value="{{ $flight->price }}">
<button type="submit" class="btn btn-success">
رزرو تور
</button>
</form> @else
<a href="{{ route('auth.login.index') }}" class="btn btn-warning btn-lg px-5">
برای رزرو وارد شوید
</a>
@endauth
</div>
<div>
<span>تعداد مشاهده</span>
+3
View File
@@ -312,6 +312,9 @@
نظرات قبلی
</a>
<a href="{{route('users.reservations.index')}}">
رزرو من
</a>
<form action="{{ route('auth.logout.index') }}" method="POST">
+26
View File
@@ -101,7 +101,33 @@
<p class="mt-3">
{{ $tour->description }}
</p>
<div class="mt-4">
@auth
<form action="{{ route('users.reservations.store') }}" method="POST">
@csrf
<input type="hidden" name="reservable_id" value="{{ $tour->id }}">
<input type="hidden" name="reservable_type" value="App\Models\Tour">
<input type="hidden" name="price" value="{{ $tour->price }}">
<button type="submit" class="btn btn-success">
رزرو تور
</button>
</form> @else
<a href="{{ route('auth.login.index') }}" class="btn btn-warning btn-lg px-5">
برای رزرو وارد شوید
</a>
@endauth
</div>
<div>
<span>تعداد مشاهده</span>
+7
View File
@@ -7,6 +7,7 @@ use App\Http\Controllers\FavoriteController;
use App\Http\Controllers\FlightController;
use App\Http\Controllers\HomeController;
use App\Http\Controllers\ProfileController;
use App\Http\Controllers\ReservationController;
use App\Http\Controllers\TourController;
use Illuminate\Support\Facades\Route;
@@ -37,4 +38,10 @@ Route::prefix('users')->name('users.')->middleware('auth:web')->group(function (
Route::get('/cities/{province}', [CityController::class, 'byProvince'])->name('cities.province');
Route::get('/reservations', [ReservationController::class, 'index'])->name('reservations.index');
Route::post('/reservations', [ReservationController::class, 'store'])->name('reservations.store');
});