--
-- Host: localhost    Database: gym
-- ------------------------------------------------------


--
-- Table structure for table `absences`
--

CREATE TABLE `absences` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `member_id` bigint(20) unsigned NOT NULL,
  `waktu_scan` datetime NOT NULL,
  `keterangan` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `absences_member_id_foreign` (`member_id`),
  CONSTRAINT `absences_member_id_foreign` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `absences`
--

INSERT INTO `absences` VALUES (8,14,'2025-08-03 06:37:33',NULL,'2025-08-02 23:37:33','2025-08-02 23:37:33'),(9,16,'2025-08-04 14:59:26',NULL,'2025-08-04 07:59:26','2025-08-04 07:59:26'),(10,17,'2025-08-04 15:14:50',NULL,'2025-08-04 08:14:50','2025-08-04 08:14:50');

--
-- Table structure for table `failed_jobs`
--

CREATE TABLE `failed_jobs` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `connection` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `queue` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `failed_jobs`
--


--
-- Table structure for table `instrukturs`
--

CREATE TABLE `instrukturs` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `nama` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `kontak` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `alamat` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `instrukturs`
--

INSERT INTO `instrukturs` VALUES (4,'Pangga Dynar','08587698690','Pakis RT.20 RW.07, Masaran, Masaran','2025-08-02 01:13:13','2025-08-02 01:13:13'),(5,'Alip Real Photo','089767543653','Kaliwuluh RT.19 RW.28, Masaran, Masaran','2025-08-02 01:13:55','2025-08-02 01:13:55'),(6,'Arip Tiktok','087654365436','Karangjati, Masaran','2025-08-04 08:05:52','2025-08-04 08:05:52');

--
-- Table structure for table `members`
--

CREATE TABLE `members` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `nama` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `kontak` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `alamat` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `qr_code` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `expired_at` date DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `members`
--

INSERT INTO `members` VALUES (14,'Fauzan Rifai','083865742777','Rejowinangun RT.19 RW.06, Masaran, Sragen',NULL,'2025-08-02',1,'2025-08-02 00:01:09','2025-08-04 07:55:55'),(15,'Ananda Abdul','087812728957','Pengkok RT.12 RT.01, Masaran',NULL,'2025-09-08',1,'2025-08-02 00:12:50','2025-08-02 00:12:50'),(16,'Sepnu Luhur','0897657643','Kuyang RT04 RW01, Kliwonan, Masaran',NULL,'2025-09-04',1,'2025-08-04 07:52:24','2025-08-04 07:52:24'),(17,'Esa Kamelia','0898776547432','Kuyang RT04 RW01, Kliwonan, Masaran',NULL,'2025-09-08',1,'2025-08-04 08:08:25','2025-08-04 08:08:25'),(18,'Maliki Setyawan','089111222333','masaran',NULL,'2025-09-05',1,'2025-08-05 00:15:08','2025-08-05 00:15:08');

--
-- Table structure for table `migrations`
--

CREATE TABLE `migrations` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `batch` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `migrations`
--

INSERT INTO `migrations` VALUES (1,'2014_10_12_000000_create_users_table',1),(2,'2014_10_12_100000_create_password_resets_table',1),(3,'2019_08_19_000000_create_failed_jobs_table',1),(4,'2019_12_14_000001_create_personal_access_tokens_table',1),(5,'2025_07_09_000000_create_gym_tables',1),(6,'2025_07_12_080614_add_nama_pembeli_to_purchases_table',2),(7,'2025_07_16_000000_create_visitors_table',3),(8,'2025_07_17_000000_create_instrukturs_table',4),(9,'2025_07_17_000001_create_pt_purchases_table',5);

--
-- Table structure for table `notifications`
--

CREATE TABLE `notifications` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `member_id` bigint(20) unsigned NOT NULL,
  `jenis` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `konten` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `dibaca` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `notifications_member_id_foreign` (`member_id`),
  CONSTRAINT `notifications_member_id_foreign` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `notifications`
--


--
-- Table structure for table `personal_trainers`
--

CREATE TABLE `personal_trainers` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `nama` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `kontak` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `keahlian` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `personal_trainers`
--

INSERT INTO `personal_trainers` VALUES (2,'tomas al malaka','1234567889123','semua','aktif','2025-07-13 08:42:02','2025-07-13 08:46:40'),(4,'alexander ngatimin','077888777666','Youth Fitness','aktif','2025-07-14 09:27:16','2025-07-14 09:27:16');

--
-- Table structure for table `products`
--

CREATE TABLE `products` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `nama` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `kategori` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
  `stok` int(11) NOT NULL DEFAULT 0,
  `harga` decimal(12,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `products`
--

INSERT INTO `products` VALUES (20,'Member Card','merchandise',995,125000.00,'2025-08-02 00:02:56','2025-08-05 00:15:46'),(21,'Amidis 600ml','air_minum',998,4000.00,'2025-08-02 00:06:12','2025-08-04 08:29:29'),(22,'Amidis 1L','air_minum',899,10000.00,'2025-08-02 00:06:41','2025-08-04 08:10:43'),(23,'Singlet UA','merchandise',97,150000.00,'2025-08-02 00:07:17','2025-08-04 08:02:39'),(24,'Personal Trainer Visit','pt_visit',999,50000.00,'2025-08-02 00:07:55','2025-08-02 00:07:55'),(25,'Personal Trainer 6 Sesi','pt_sesi',999,350000.00,'2025-08-02 00:10:05','2025-08-02 00:10:05'),(26,'Personal Trainer 12 Sesi','pt_sesi',999,550000.00,'2025-08-02 00:10:32','2025-08-02 00:10:32'),(27,'visit_only','pt_visit',999,15000.00,'2025-08-02 22:56:02','2025-08-02 23:09:22'),(28,'BCAA','suplement',499,3000.00,'2025-08-04 08:01:23','2025-08-04 08:02:39');

--
-- Table structure for table `pt_purchases`
--

CREATE TABLE `pt_purchases` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `member_id` bigint(20) unsigned DEFAULT NULL,
  `visitor_id` bigint(20) unsigned DEFAULT NULL,
  `produk_id` bigint(20) unsigned NOT NULL,
  `instruktur_id` bigint(20) unsigned DEFAULT NULL,
  `tanggal` date NOT NULL,
  `harga` int(11) NOT NULL,
  `payment_method` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `bayar` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `kembalian` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `pt_purchases_member_id_foreign` (`member_id`),
  KEY `pt_purchases_visitor_id_foreign` (`visitor_id`),
  KEY `pt_purchases_produk_id_foreign` (`produk_id`),
  KEY `pt_purchases_instruktur_id_foreign` (`instruktur_id`),
  CONSTRAINT `pt_purchases_instruktur_id_foreign` FOREIGN KEY (`instruktur_id`) REFERENCES `instrukturs` (`id`) ON DELETE SET NULL,
  CONSTRAINT `pt_purchases_member_id_foreign` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) ON DELETE SET NULL,
  CONSTRAINT `pt_purchases_produk_id_foreign` FOREIGN KEY (`produk_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  CONSTRAINT `pt_purchases_visitor_id_foreign` FOREIGN KEY (`visitor_id`) REFERENCES `visitors` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `pt_purchases`
--

INSERT INTO `pt_purchases` VALUES (6,15,NULL,25,4,'2025-08-02',350000,'cash','400000','50000','2025-08-02 01:39:11','2025-08-02 01:39:11'),(7,14,NULL,24,5,'2025-08-02',50000,'cash','100000','50000','2025-08-02 01:40:26','2025-08-02 01:40:26'),(8,NULL,NULL,24,6,'2025-08-04',50000,'cash','50000','0','2025-08-04 08:06:35','2025-08-04 08:06:35'),(9,NULL,11,24,4,'2025-08-05',50000,'cash','70000','5000','2025-08-05 00:35:21','2025-08-05 00:35:21');

--
-- Table structure for table `pt_sessions`
--

CREATE TABLE `pt_sessions` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `member_id` bigint(20) unsigned NOT NULL,
  `personal_trainer_id` bigint(20) unsigned NOT NULL,
  `waktu` datetime NOT NULL,
  `keterangan` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `pt_sessions_member_id_foreign` (`member_id`),
  KEY `pt_sessions_personal_trainer_id_foreign` (`personal_trainer_id`),
  CONSTRAINT `pt_sessions_member_id_foreign` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) ON DELETE CASCADE,
  CONSTRAINT `pt_sessions_personal_trainer_id_foreign` FOREIGN KEY (`personal_trainer_id`) REFERENCES `personal_trainers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `pt_sessions`
--


--
-- Table structure for table `purchase_details`
--

CREATE TABLE `purchase_details` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `purchase_id` bigint(20) unsigned NOT NULL,
  `product_id` bigint(20) unsigned NOT NULL,
  `qty` int(11) NOT NULL,
  `harga_satuan` decimal(12,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `purchase_details_purchase_id_foreign` (`purchase_id`),
  KEY `purchase_details_product_id_foreign` (`product_id`),
  CONSTRAINT `purchase_details_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  CONSTRAINT `purchase_details_purchase_id_foreign` FOREIGN KEY (`purchase_id`) REFERENCES `purchases` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=72 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `purchase_details`
--

INSERT INTO `purchase_details` VALUES (63,31,20,1,125000.00,'2025-08-02 00:03:48','2025-08-02 00:03:48'),(64,32,20,1,125000.00,'2025-08-02 00:13:27','2025-08-02 00:13:27'),(65,32,23,1,150000.00,'2025-08-02 00:13:27','2025-08-02 00:13:27'),(66,32,22,1,10000.00,'2025-08-02 00:13:27','2025-08-02 00:13:27'),(67,33,20,1,125000.00,'2025-08-04 07:53:37','2025-08-04 07:53:37'),(68,34,28,1,3000.00,'2025-08-04 08:02:39','2025-08-04 08:02:39'),(69,34,23,1,150000.00,'2025-08-04 08:02:39','2025-08-04 08:02:39'),(70,35,21,1,4000.00,'2025-08-04 08:29:29','2025-08-04 08:29:29'),(71,36,20,1,125000.00,'2025-08-05 00:15:46','2025-08-05 00:15:46');

--
-- Table structure for table `purchases`
--

CREATE TABLE `purchases` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `member_id` bigint(20) unsigned DEFAULT NULL,
  `nama_pembeli` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `alamat_pembeli` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `tanggal` datetime NOT NULL,
  `total_harga` decimal(12,2) NOT NULL,
  `bayar` int(11) DEFAULT NULL,
  `kembali` int(11) DEFAULT NULL,
  `payment_method` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `purchases_member_id_foreign` (`member_id`),
  CONSTRAINT `purchases_member_id_foreign` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `purchases`
--

INSERT INTO `purchases` VALUES (31,14,'Fauzan Rifai','Rejowinangun RT.19 RW.06, Masaran, Sragen','2025-08-02 07:03:48',125000.00,150000,25000,'cash','2025-08-02 00:03:48','2025-08-02 00:03:48'),(32,15,'Ananda Abdul','Pengkok RT.12 RT.01, Masaran','2025-08-02 07:13:27',285000.00,300000,15000,'cash','2025-08-02 00:13:27','2025-08-02 00:13:27'),(33,16,'Sepnu Luhur','Kuyang RT04 RW01, Kliwonan, Masaran','2025-08-04 14:53:37',125000.00,150000,25000,'cash','2025-08-04 07:53:37','2025-08-04 07:53:37'),(34,NULL,'Esa Kamelia','Kuyang RT04 RW01, Kliwonan, Masaran','2025-08-04 15:02:39',153000.00,200000,47000,'cash','2025-08-04 08:02:39','2025-08-04 08:02:39'),(35,NULL,'adittya','gronong','2025-08-04 15:29:29',4000.00,20000,16000,'cash','2025-08-04 08:29:29','2025-08-04 08:29:29'),(36,18,'Maliki Setyawan','masaran','2025-08-05 07:15:46',125000.00,130000,5000,'cash','2025-08-05 00:15:46','2025-08-05 00:15:46');

--
-- Table structure for table `visitor_attendances`
--

CREATE TABLE `visitor_attendances` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `visitor_id` bigint(20) unsigned NOT NULL,
  `tanggal` date NOT NULL,
  `jam_masuk` time DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `harga` int(11) DEFAULT 0,
  `bayar` int(11) DEFAULT 0,
  `kembalian` int(11) DEFAULT 0,
  `payment_method` varchar(30) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_visitor_attendances_visitor_id` (`visitor_id`),
  CONSTRAINT `fk_visitor_attendances_visitor_id` FOREIGN KEY (`visitor_id`) REFERENCES `visitors` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `visitor_attendances`
--

INSERT INTO `visitor_attendances` VALUES (1,11,'2025-08-03','06:09:37','2025-08-02 23:09:37','2025-08-02 23:09:37',15000,20000,5000,'cash'),(3,13,'2025-08-04','15:27:48','2025-08-04 08:27:48','2025-08-04 08:27:48',15000,20000,5000,'debit'),(4,11,'2025-08-05','07:35:21','2025-08-05 00:35:21','2025-08-05 00:35:21',15000,0,0,'cash'),(5,13,'2025-08-05','07:40:35','2025-08-05 00:40:35','2025-08-05 00:40:35',15000,15000,0,'qris');

--
-- Table structure for table `visitors`
--

CREATE TABLE `visitors` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `nama` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `alamat` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `kontak` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `visitors`
--

INSERT INTO `visitors` VALUES (11,'Bruri Suciarto','Tegalrejo RT20 RW07, Masaran','087687564353','2025-08-02 22:55:26','2025-08-02 23:36:33'),(13,'adittya','gronong','08745632546','2025-08-04 08:27:18','2025-08-04 08:27:18');


