

CREATE TABLE `academic_sessions` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `branch_id` bigint(20) unsigned NOT NULL,
  `name` varchar(255) NOT NULL,
  `start_date` date DEFAULT NULL,
  `end_date` date DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `academic_sessions_branch_id_name_unique` (`branch_id`,`name`),
  CONSTRAINT `academic_sessions_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `academic_sessions` (`id`, `branch_id`, `name`, `start_date`, `end_date`, `is_active`, `created_at`, `updated_at`) VALUES ('3', '3', '2026', '2026-01-01', '2026-12-31', '1', '2026-10-16 11:14:35', '2026-10-16 11:14:35');
INSERT INTO `academic_sessions` (`id`, `branch_id`, `name`, `start_date`, `end_date`, `is_active`, `created_at`, `updated_at`) VALUES ('4', '3', '2025', '2025-01-01', '2025-12-31', '0', '2026-10-16 12:51:53', '2026-10-16 12:51:53');
INSERT INTO `academic_sessions` (`id`, `branch_id`, `name`, `start_date`, `end_date`, `is_active`, `created_at`, `updated_at`) VALUES ('5', '4', '2026', '2026-01-01', '2026-12-31', '1', '2026-10-16 17:10:33', '2026-10-16 17:10:33');


CREATE TABLE `branches` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `code` varchar(255) NOT NULL,
  `address` varchar(255) DEFAULT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `branches_code_unique` (`code`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `branches` (`id`, `name`, `code`, `address`, `phone`, `email`, `status`, `created_at`, `updated_at`) VALUES ('3', 'Main Branch', 'main-1', '257/1/G Ahmed Nagar, Paikpara, Mirpur-1, Dhaka-1216', '01674099838', 'iconacademy2000e@gmail.com', '1', '2026-10-16 11:11:54', '2026-10-16 11:11:54');
INSERT INTO `branches` (`id`, `name`, `code`, `address`, `phone`, `email`, `status`, `created_at`, `updated_at`) VALUES ('4', 'Monipur', 'asdf', 'asdf', '987878', 'asd@ds.com', '1', '2026-10-16 12:40:56', '2026-10-16 12:40:56');


CREATE TABLE `cache` (
  `key` varchar(255) NOT NULL,
  `value` mediumtext NOT NULL,
  `expiration` int(11) NOT NULL,
  PRIMARY KEY (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;



CREATE TABLE `cache_locks` (
  `key` varchar(255) NOT NULL,
  `owner` varchar(255) NOT NULL,
  `expiration` int(11) NOT NULL,
  PRIMARY KEY (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;



CREATE TABLE `class_groups` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `group_name` varchar(255) NOT NULL,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `class_groups_branch_id_group_name_unique` (`branch_id`,`group_name`),
  CONSTRAINT `class_groups_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `class_groups` (`id`, `group_name`, `branch_id`, `created_at`, `updated_at`) VALUES ('2', 'General', '3', '2026-10-16 11:44:31', '2026-10-16 11:44:31');
INSERT INTO `class_groups` (`id`, `group_name`, `branch_id`, `created_at`, `updated_at`) VALUES ('3', 'General', '4', '2026-10-16 17:21:48', '2026-10-16 17:21:48');


CREATE TABLE `class_subject` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `class_id` bigint(20) unsigned NOT NULL,
  `subject_id` bigint(20) unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `class_subject_class_id_subject_id_unique` (`class_id`,`subject_id`),
  KEY `class_subject_subject_id_foreign` (`subject_id`),
  CONSTRAINT `class_subject_class_id_foreign` FOREIGN KEY (`class_id`) REFERENCES `clss_m_s` (`id`) ON DELETE CASCADE,
  CONSTRAINT `class_subject_subject_id_foreign` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('15', '3', '14', NULL, NULL);
INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('16', '3', '13', NULL, NULL);
INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('17', '3', '12', NULL, NULL);
INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('18', '3', '9', NULL, NULL);
INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('19', '3', '10', NULL, NULL);
INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('20', '3', '11', NULL, NULL);
INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('21', '3', '8', NULL, NULL);
INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('22', '4', '14', NULL, NULL);
INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('23', '4', '13', NULL, NULL);
INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('24', '4', '12', NULL, NULL);
INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('25', '4', '9', NULL, NULL);
INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('26', '4', '10', NULL, NULL);
INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('27', '4', '11', NULL, NULL);
INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('28', '4', '8', NULL, NULL);
INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('29', '5', '21', NULL, NULL);
INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('30', '5', '20', NULL, NULL);
INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('31', '5', '19', NULL, NULL);
INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('32', '5', '18', NULL, NULL);
INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('33', '5', '17', NULL, NULL);
INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('34', '5', '16', NULL, NULL);
INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('35', '5', '15', NULL, NULL);


CREATE TABLE `clss_m_s` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `class_name` varchar(255) NOT NULL,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `clss_m_s_branch_id_foreign` (`branch_id`),
  CONSTRAINT `clss_m_s_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `clss_m_s` (`id`, `class_name`, `branch_id`, `created_at`, `updated_at`) VALUES ('3', 'Class 6', '3', '2026-10-16 11:43:43', '2026-10-16 11:43:43');
INSERT INTO `clss_m_s` (`id`, `class_name`, `branch_id`, `created_at`, `updated_at`) VALUES ('4', 'Class 7', '3', '2026-10-16 11:44:55', '2026-10-16 11:44:55');
INSERT INTO `clss_m_s` (`id`, `class_name`, `branch_id`, `created_at`, `updated_at`) VALUES ('5', 'Class 6', '4', '2026-10-16 17:21:18', '2026-10-16 17:21:18');


CREATE TABLE `examinations` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `examination_type` varchar(255) NOT NULL,
  `examination_year` varchar(255) NOT NULL,
  `exam_mark` decimal(8,2) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `examinations_branch_id_foreign` (`branch_id`),
  CONSTRAINT `examinations_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `examinations` (`id`, `branch_id`, `examination_type`, `examination_year`, `exam_mark`, `created_at`, `updated_at`) VALUES ('5', '4', 'FINAL', '2026', NULL, '2026-10-16 17:26:13', '2026-10-16 17:26:13');


CREATE TABLE `expenses` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `academic_session_id` bigint(20) unsigned DEFAULT NULL,
  `expense_type` varchar(255) NOT NULL,
  `employee_name` varchar(255) DEFAULT NULL,
  `salary_amount` decimal(10,2) NOT NULL,
  `paid_amount` decimal(10,2) NOT NULL,
  `due_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `payment_method` enum('Cash','Bkash','Nagad','Bank') NOT NULL,
  `created_by` varchar(255) DEFAULT NULL,
  `payment_date` date NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `payment_month` date DEFAULT NULL,
  `remarks` text DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `expenses_branch_id_foreign` (`branch_id`),
  KEY `expenses_academic_session_id_foreign` (`academic_session_id`),
  CONSTRAINT `expenses_academic_session_id_foreign` FOREIGN KEY (`academic_session_id`) REFERENCES `academic_sessions` (`id`) ON DELETE SET NULL,
  CONSTRAINT `expenses_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `expenses` (`id`, `branch_id`, `academic_session_id`, `expense_type`, `employee_name`, `salary_amount`, `paid_amount`, `due_amount`, `payment_method`, `created_by`, `payment_date`, `created_at`, `updated_at`, `payment_month`, `remarks`) VALUES ('4', '3', '3', 'Electricity Bill', NULL, '500.00', '500.00', '0.00', 'Cash', 'MOSHARRAF HOSSAIN', '2026-10-16', '2026-10-16 16:53:35', '2026-10-16 16:53:35', '2026-10-01', 'This is Oct. Month Electricity Bill');


CREATE TABLE `failed_jobs` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `uuid` varchar(255) NOT NULL,
  `connection` text NOT NULL,
  `queue` text NOT NULL,
  `payload` longtext NOT NULL,
  `exception` longtext 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;



CREATE TABLE `final_results` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `examination_id` bigint(20) unsigned NOT NULL,
  `percentage` decimal(5,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `final_results_examination_id_foreign` (`examination_id`),
  CONSTRAINT `final_results_examination_id_foreign` FOREIGN KEY (`examination_id`) REFERENCES `examinations` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `final_results` (`id`, `examination_id`, `percentage`, `created_at`, `updated_at`) VALUES ('5', '5', '100.00', '2026-10-16 17:31:06', '2026-10-16 17:31:06');


CREATE TABLE `grading_systems` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `grade` varchar(10) NOT NULL,
  `grade_point` decimal(3,2) NOT NULL,
  `min_percentage` decimal(5,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `grading_systems` (`id`, `grade`, `grade_point`, `min_percentage`, `created_at`, `updated_at`) VALUES ('1', 'A+', '5.00', '80.00', NULL, NULL);
INSERT INTO `grading_systems` (`id`, `grade`, `grade_point`, `min_percentage`, `created_at`, `updated_at`) VALUES ('2', 'A', '4.00', '70.00', NULL, NULL);
INSERT INTO `grading_systems` (`id`, `grade`, `grade_point`, `min_percentage`, `created_at`, `updated_at`) VALUES ('3', 'A-', '3.50', '60.00', NULL, NULL);
INSERT INTO `grading_systems` (`id`, `grade`, `grade_point`, `min_percentage`, `created_at`, `updated_at`) VALUES ('4', 'B', '3.00', '50.00', NULL, NULL);
INSERT INTO `grading_systems` (`id`, `grade`, `grade_point`, `min_percentage`, `created_at`, `updated_at`) VALUES ('5', 'C', '2.00', '40.00', NULL, NULL);
INSERT INTO `grading_systems` (`id`, `grade`, `grade_point`, `min_percentage`, `created_at`, `updated_at`) VALUES ('6', 'D', '1.00', '33.00', NULL, NULL);
INSERT INTO `grading_systems` (`id`, `grade`, `grade_point`, `min_percentage`, `created_at`, `updated_at`) VALUES ('7', 'F', '0.00', '0.00', NULL, NULL);


CREATE TABLE `group_subject_mappings` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `class_group_id` bigint(20) unsigned NOT NULL,
  `subject_id` bigint(20) unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `group_subject_mappings_class_group_id_subject_id_unique` (`class_group_id`,`subject_id`),
  KEY `group_subject_mappings_subject_id_foreign` (`subject_id`),
  CONSTRAINT `group_subject_mappings_class_group_id_foreign` FOREIGN KEY (`class_group_id`) REFERENCES `class_groups` (`id`) ON DELETE CASCADE,
  CONSTRAINT `group_subject_mappings_subject_id_foreign` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `group_subject_mappings` (`id`, `class_group_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('1', '3', '15', '2026-10-16 17:21:48', '2026-10-16 17:21:48');
INSERT INTO `group_subject_mappings` (`id`, `class_group_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('2', '3', '16', '2026-10-16 17:21:49', '2026-10-16 17:21:49');


CREATE TABLE `group_subjects` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `class_group_id` bigint(20) unsigned NOT NULL,
  `subject_id` bigint(20) unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `group_subjects_class_group_id_subject_id_unique` (`class_group_id`,`subject_id`),
  KEY `group_subjects_subject_id_foreign` (`subject_id`),
  CONSTRAINT `group_subjects_class_group_id_foreign` FOREIGN KEY (`class_group_id`) REFERENCES `class_groups` (`id`) ON DELETE CASCADE,
  CONSTRAINT `group_subjects_subject_id_foreign` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `group_subjects` (`id`, `class_group_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('2', '2', '14', NULL, NULL);
INSERT INTO `group_subjects` (`id`, `class_group_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('3', '3', '21', NULL, NULL);


CREATE TABLE `holidays` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `title` varchar(255) NOT NULL,
  `start_date` date NOT NULL,
  `end_date` date NOT NULL,
  `description` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `holidays_branch_id_foreign` (`branch_id`),
  CONSTRAINT `holidays_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `holidays` (`id`, `branch_id`, `title`, `start_date`, `end_date`, `description`, `created_at`, `updated_at`) VALUES ('2', '3', 'Iccha Chuti', '2026-10-17', '2026-10-17', 'This is Iccha chuti', '2026-10-16 12:27:18', '2026-10-16 12:27:18');
INSERT INTO `holidays` (`id`, `branch_id`, `title`, `start_date`, `end_date`, `description`, `created_at`, `updated_at`) VALUES ('3', '4', 'Test Holiday', '2026-10-17', '2026-10-17', 'This Holiday is for testing', '2026-10-16 17:18:29', '2026-10-16 17:18:29');


CREATE TABLE `institute_infos` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `institute_name` varchar(255) NOT NULL,
  `established_year` varchar(255) DEFAULT NULL,
  `location` varchar(255) DEFAULT NULL,
  `contact` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `logo` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `institute_infos_branch_id_index` (`branch_id`),
  CONSTRAINT `institute_infos_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `institute_infos` (`id`, `branch_id`, `institute_name`, `established_year`, `location`, `contact`, `email`, `logo`, `created_at`, `updated_at`) VALUES ('2', '3', 'ICON ACADEMY', '2000', '257/1/G Ahmed Nagar, Paikpara, Mirpur-1, Dhaka-1216', '01674099838', NULL, 'institute/1792149200_Ib0Xf47YR9.jpeg', '2026-10-16 11:13:20', '2026-10-16 11:13:20');
INSERT INTO `institute_infos` (`id`, `branch_id`, `institute_name`, `established_year`, `location`, `contact`, `email`, `logo`, `created_at`, `updated_at`) VALUES ('3', '4', 'ICON ACADEMY', '2000', 'Monipur, Mirpur-2, Dhaka-1216', '01753787564', NULL, 'institute/1792170521_dqXQBZAB1l.jpeg', '2026-10-16 17:08:41', '2026-10-16 17:08:41');


CREATE TABLE `job_batches` (
  `id` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `total_jobs` int(11) NOT NULL,
  `pending_jobs` int(11) NOT NULL,
  `failed_jobs` int(11) NOT NULL,
  `failed_job_ids` longtext NOT NULL,
  `options` mediumtext DEFAULT NULL,
  `cancelled_at` int(11) DEFAULT NULL,
  `created_at` int(11) NOT NULL,
  `finished_at` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;



CREATE TABLE `jobs` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `queue` varchar(255) NOT NULL,
  `payload` longtext NOT NULL,
  `attempts` tinyint(3) unsigned NOT NULL,
  `reserved_at` int(10) unsigned DEFAULT NULL,
  `available_at` int(10) unsigned NOT NULL,
  `created_at` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`),
  KEY `jobs_queue_index` (`queue`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;



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

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('1', '0001_01_01_000000_create_users_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('2', '0001_01_01_000001_create_cache_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('3', '0001_01_01_000002_create_jobs_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('4', '2026_01_02_152655_create_teachers_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('5', '2026_01_02_164123_create_teachers_attendances_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('6', '2026_02_07_071712_create_shifts_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('7', '2026_04_23_074928_create_sections_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('8', '2026_05_10_191531_create_examinations_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('9', '2026_05_11_210152_create_personal_access_tokens_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('10', '2026_05_18_234106_create_clss_m_s_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('11', '2026_05_19_061918_students', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('12', '2026_05_19_115201_create_payments_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('13', '2026_05_19_182404_add_month_to_payments_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('14', '2026_06_20_161735_create_results_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('15', '2026_07_11_094428_add_exit_time_to_teacher_attendances_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('16', '2026_07_16_083620_add_monthly_fee_to_students_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('17', '2026_07_17_193256_add_admission_fee_and_exam_fee_to_payments_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('18', '2026_07_18_075010_create_other_payments_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('19', '2026_07_19_104636_create_expenses_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('20', '2026_07_19_133530_add_payment_month_to_expenses_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('21', '2026_07_30_174357_add_created_by_to_expenses_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('22', '2026_08_02_152559_create_model_names_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('23', '2026_08_11_154210_staff', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('24', '2026_08_25_095835_create_staff_attendances_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('25', '2026_08_27_191706_create_holidays_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('26', '2026_08_28_120440_create_subjects_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('27', '2026_08_28_121348_create_class_subject_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('28', '2026_08_28_183831_create_result_subjects_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('29', '2026_08_31_175137_create_class_groups_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('30', '2026_08_31_175526_create_group_subjects_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('31', '2026_08_31_190731_add_class_group_id_to_students_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('32', '2026_09_01_160715_create_institute_infos_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('33', '2026_09_07_124506_create_group_subject_mappings_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('34', '2026_09_08_082408_add_full_mark_column_to_subjects_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('35', '2026_09_08_090418_create_grading_systems_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('36', '2026_09_08_201522_add_exam_mark_to_examinations_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('37', '2026_09_10_183844_create_final_results_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('38', '2026_09_16_213755_add_version_to_students_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('39', '2026_09_26_075457_create_branches_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('40', '2026_09_26_084953_add_branch_id_to_staff_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('41', '2026_09_26_143458_add_branch_id_to_clss_m_s_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('42', '2026_09_26_151140_add_branch_id_to_class_groups_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('43', '2026_09_26_170151_add_branch_id_to_sections_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('44', '2026_09_26_171433_add_branch_id_to_shifts_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('45', '2026_09_26_173225_add_branch_id_to_subjects_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('46', '2026_09_26_175622_add_branch_id_to_students_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('47', '2026_09_27_060613_add_branch_id_to_teachers_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('48', '2026_09_28_070702_add_branch_id_to_teachers_attendances_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('49', '2026_09_28_071847_add_branch_id_to_staff_attendances_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('50', '2026_09_28_092806_add_branch_id_to_examinations_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('51', '2026_09_28_101042_add_branch_id_to_results_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('52', '2026_09_28_111533_add_branch_id_to_holidays_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('53', '2026_09_28_235821_add_branch_id_to_expenses_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('54', '2026_09_30_045513_add_branch_id_to_institute_infos_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('55', '2026_10_02_192341_create_student_attendances_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('56', '2026_10_03_170617_add_leave_to_student_attendances_status', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('57', '2026_10_12_080903_create_academic_sessions_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('58', '2026_10_12_081734_create_student_sessions_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('59', '2026_10_12_084212_add_student_session_id_to_results_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('60', '2026_10_12_114006_add_student_session_id_to_student_attendances_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('61', '2026_10_12_114742_update_student_attendance_unique_constraint', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('62', '2026_10_12_200323_add_class_snapshot_fields_to_results_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('63', '2026_10_12_215030_add_student_session_id_to_payments_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('64', '2026_10_13_093055_add_student_session_id_to_other_payments_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('65', '2026_10_13_111324_add_academic_session_id_to_expenses_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('66', '2026_10_14_142859_add_due_payment_fields_to_payments_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('67', '2026_10_14_184742_add_payment_type_to_other_payments_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('68', '2026_10_14_223344_add_remarks_to_expenses_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('69', '2026_10_15_133138_add_student_roll_and_second_phone_to_students_table', '2');


CREATE TABLE `model_names` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;



CREATE TABLE `other_payments` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `student_id` bigint(20) unsigned NOT NULL,
  `student_session_id` bigint(20) unsigned DEFAULT NULL,
  `payment_type` varchar(255) NOT NULL DEFAULT 'Other',
  `item_name` varchar(255) NOT NULL,
  `quantity` int(11) NOT NULL,
  `price` decimal(10,2) NOT NULL,
  `total_amount` decimal(10,2) NOT NULL,
  `payment_method` varchar(255) NOT NULL,
  `payment_date` date NOT NULL,
  `remarks` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `other_payments_student_id_foreign` (`student_id`),
  KEY `other_payments_student_session_id_foreign` (`student_session_id`),
  CONSTRAINT `other_payments_student_id_foreign` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE,
  CONSTRAINT `other_payments_student_session_id_foreign` FOREIGN KEY (`student_session_id`) REFERENCES `student_sessions` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `other_payments` (`id`, `student_id`, `student_session_id`, `payment_type`, `item_name`, `quantity`, `price`, `total_amount`, `payment_method`, `payment_date`, `remarks`, `created_at`, `updated_at`) VALUES ('2', '8', '8', 'Admission Fee', 'Admission Fee', '1', '500.00', '500.00', 'Cash', '2026-10-16', '2nd Tutorial Examination fee', '2026-10-16 16:41:12', '2026-10-16 16:41:12');
INSERT INTO `other_payments` (`id`, `student_id`, `student_session_id`, `payment_type`, `item_name`, `quantity`, `price`, `total_amount`, `payment_method`, `payment_date`, `remarks`, `created_at`, `updated_at`) VALUES ('3', '10', '10', 'Other', 'Book', '1', '500.00', '500.00', 'Cash', '2026-10-16', 'Class play 1 pcs Book', '2026-10-16 16:44:23', '2026-10-16 16:44:23');


CREATE TABLE `password_reset_tokens` (
  `email` varchar(255) NOT NULL,
  `token` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;



CREATE TABLE `payments` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `student_id` bigint(20) unsigned NOT NULL,
  `student_session_id` bigint(20) unsigned DEFAULT NULL,
  `amount` decimal(10,2) NOT NULL,
  `paid_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `admission_fee` decimal(10,2) DEFAULT NULL,
  `exam_fee` decimal(10,2) DEFAULT NULL,
  `due_amount` decimal(10,2) DEFAULT NULL,
  `payment_method` varchar(255) DEFAULT NULL,
  `payment_date` date DEFAULT NULL,
  `status` enum('paid','due') NOT NULL DEFAULT 'due',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `month` varchar(255) DEFAULT NULL,
  `due_month` varchar(255) DEFAULT NULL,
  `due_payment_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  PRIMARY KEY (`id`),
  KEY `payments_student_id_foreign` (`student_id`),
  KEY `payments_session_month_index` (`student_session_id`,`month`),
  CONSTRAINT `payments_student_id_foreign` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE,
  CONSTRAINT `payments_student_session_id_foreign` FOREIGN KEY (`student_session_id`) REFERENCES `student_sessions` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `payments` (`id`, `student_id`, `student_session_id`, `amount`, `paid_amount`, `admission_fee`, `exam_fee`, `due_amount`, `payment_method`, `payment_date`, `status`, `created_at`, `updated_at`, `month`, `due_month`, `due_payment_amount`) VALUES ('10', '11', '11', '2000.00', '2000.00', '0.00', '0.00', '0.00', 'Cash', '2026-10-16', 'paid', '2026-10-16 12:59:37', '2026-10-16 12:59:37', 'September', NULL, '0.00');
INSERT INTO `payments` (`id`, `student_id`, `student_session_id`, `amount`, `paid_amount`, `admission_fee`, `exam_fee`, `due_amount`, `payment_method`, `payment_date`, `status`, `created_at`, `updated_at`, `month`, `due_month`, `due_payment_amount`) VALUES ('11', '10', '10', '2000.00', '1500.00', '0.00', '0.00', '500.00', 'Cash', '2026-10-16', 'due', '2026-10-16 13:01:26', '2026-10-16 13:01:26', 'September', NULL, '0.00');
INSERT INTO `payments` (`id`, `student_id`, `student_session_id`, `amount`, `paid_amount`, `admission_fee`, `exam_fee`, `due_amount`, `payment_method`, `payment_date`, `status`, `created_at`, `updated_at`, `month`, `due_month`, `due_payment_amount`) VALUES ('13', '10', '10', '2000.00', '2000.00', '0.00', '0.00', '0.00', 'Cash', '2026-10-16', 'paid', '2026-10-16 13:12:07', '2026-10-16 13:12:07', 'October', 'September', '500.00');
INSERT INTO `payments` (`id`, `student_id`, `student_session_id`, `amount`, `paid_amount`, `admission_fee`, `exam_fee`, `due_amount`, `payment_method`, `payment_date`, `status`, `created_at`, `updated_at`, `month`, `due_month`, `due_payment_amount`) VALUES ('14', '9', '9', '2000.00', '1500.00', '0.00', '0.00', '500.00', 'Cash', '2026-10-16', 'due', '2026-10-16 16:55:52', '2026-10-16 16:59:24', 'October', NULL, '0.00');


CREATE TABLE `personal_access_tokens` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `tokenable_type` varchar(255) NOT NULL,
  `tokenable_id` bigint(20) unsigned NOT NULL,
  `name` text NOT NULL,
  `token` varchar(64) NOT NULL,
  `abilities` text DEFAULT NULL,
  `last_used_at` timestamp NULL DEFAULT NULL,
  `expires_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `personal_access_tokens_token_unique` (`token`),
  KEY `personal_access_tokens_tokenable_type_tokenable_id_index` (`tokenable_type`,`tokenable_id`),
  KEY `personal_access_tokens_expires_at_index` (`expires_at`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `personal_access_tokens` (`id`, `tokenable_type`, `tokenable_id`, `name`, `token`, `abilities`, `last_used_at`, `expires_at`, `created_at`, `updated_at`) VALUES ('1', 'App\\Models\\Staff', '1', 'staff-token', '6ea0f3d39a2a6a4b85467dbdb5cb0fe646dfb596d8997e52030483c41a5b9b59', '[\"*\"]', '2026-10-16 18:37:57', NULL, '2026-10-15 06:06:55', '2026-10-16 18:37:57');
INSERT INTO `personal_access_tokens` (`id`, `tokenable_type`, `tokenable_id`, `name`, `token`, `abilities`, `last_used_at`, `expires_at`, `created_at`, `updated_at`) VALUES ('2', 'App\\Models\\Staff', '7', 'staff-token', '9445e1d43449aca4140a6669cbe6e29e51911c7e3e534b1323a4be40b6185ba7', '[\"*\"]', '2026-10-16 17:37:59', NULL, '2026-10-16 17:05:24', '2026-10-16 17:37:59');


CREATE TABLE `result_subjects` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `result_id` bigint(20) unsigned NOT NULL,
  `subject_id` bigint(20) unsigned NOT NULL,
  `marks` decimal(5,2) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `result_subjects_result_id_subject_id_unique` (`result_id`,`subject_id`),
  KEY `result_subjects_subject_id_foreign` (`subject_id`),
  CONSTRAINT `result_subjects_result_id_foreign` FOREIGN KEY (`result_id`) REFERENCES `results` (`id`) ON DELETE CASCADE,
  CONSTRAINT `result_subjects_subject_id_foreign` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('29', '5', '15', '99.00', '2026-10-16 17:27:54', '2026-10-16 17:27:54');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('30', '5', '16', '99.00', '2026-10-16 17:27:54', '2026-10-16 17:27:54');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('31', '5', '17', '99.00', '2026-10-16 17:27:54', '2026-10-16 17:27:54');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('32', '5', '18', '99.00', '2026-10-16 17:27:54', '2026-10-16 17:27:54');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('33', '5', '19', '99.00', '2026-10-16 17:27:54', '2026-10-16 17:27:54');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('34', '5', '20', '99.00', '2026-10-16 17:27:54', '2026-10-16 17:27:54');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('35', '5', '21', '99.00', '2026-10-16 17:27:54', '2026-10-16 17:27:54');


CREATE TABLE `results` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `student_id` bigint(20) unsigned NOT NULL,
  `student_session_id` bigint(20) unsigned DEFAULT NULL,
  `exam_year` varchar(255) NOT NULL,
  `exam_type` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `class_name_snapshot` varchar(255) DEFAULT NULL,
  `section_name_snapshot` varchar(255) DEFAULT NULL,
  `shift_name_snapshot` varchar(255) DEFAULT NULL,
  `class_group_name_snapshot` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `results_student_id_exam_year_exam_type_unique` (`student_id`,`exam_year`,`exam_type`),
  KEY `results_branch_id_foreign` (`branch_id`),
  KEY `results_student_session_id_foreign` (`student_session_id`),
  CONSTRAINT `results_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  CONSTRAINT `results_student_id_foreign` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE,
  CONSTRAINT `results_student_session_id_foreign` FOREIGN KEY (`student_session_id`) REFERENCES `student_sessions` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `results` (`id`, `branch_id`, `student_id`, `student_session_id`, `exam_year`, `exam_type`, `created_at`, `updated_at`, `class_name_snapshot`, `section_name_snapshot`, `shift_name_snapshot`, `class_group_name_snapshot`) VALUES ('5', '4', '12', '12', '2026', 'FINAL', '2026-10-16 17:27:54', '2026-10-16 17:27:54', 'Class 6', 'A', 'Morning', 'General');


CREATE TABLE `sections` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `section_name` varchar(255) NOT NULL,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `sections_branch_id_section_name_unique` (`branch_id`,`section_name`),
  CONSTRAINT `sections_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `sections` (`id`, `section_name`, `branch_id`, `created_at`, `updated_at`) VALUES ('3', 'A', '3', '2026-10-16 11:45:30', '2026-10-16 11:45:30');
INSERT INTO `sections` (`id`, `section_name`, `branch_id`, `created_at`, `updated_at`) VALUES ('4', 'B', '3', '2026-10-16 11:45:38', '2026-10-16 11:45:38');
INSERT INTO `sections` (`id`, `section_name`, `branch_id`, `created_at`, `updated_at`) VALUES ('5', 'C', '3', '2026-10-16 11:45:45', '2026-10-16 11:45:45');
INSERT INTO `sections` (`id`, `section_name`, `branch_id`, `created_at`, `updated_at`) VALUES ('6', 'A', '4', '2026-10-16 17:20:32', '2026-10-16 17:20:32');


CREATE TABLE `sessions` (
  `id` varchar(255) NOT NULL,
  `user_id` bigint(20) unsigned DEFAULT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `payload` longtext NOT NULL,
  `last_activity` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `sessions_user_id_index` (`user_id`),
  KEY `sessions_last_activity_index` (`last_activity`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;



CREATE TABLE `shifts` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `start_time` time NOT NULL DEFAULT '09:00:00',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `shifts_branch_id_name_unique` (`branch_id`,`name`),
  CONSTRAINT `shifts_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `shifts` (`id`, `name`, `branch_id`, `start_time`, `created_at`, `updated_at`) VALUES ('3', 'Staff Shift', '3', '09:00:00', '2026-10-16 11:17:11', '2026-10-16 11:17:11');
INSERT INTO `shifts` (`id`, `name`, `branch_id`, `start_time`, `created_at`, `updated_at`) VALUES ('4', 'Morning', '3', '09:00:00', '2026-10-16 11:28:46', '2026-10-16 11:28:46');
INSERT INTO `shifts` (`id`, `name`, `branch_id`, `start_time`, `created_at`, `updated_at`) VALUES ('5', 'Day', '3', '12:00:00', '2026-10-16 11:40:00', '2026-10-16 11:40:00');
INSERT INTO `shifts` (`id`, `name`, `branch_id`, `start_time`, `created_at`, `updated_at`) VALUES ('7', 'Day', '4', '12:00:00', '2026-10-16 17:34:18', '2026-10-16 17:34:18');


CREATE TABLE `staff` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `shift_id` bigint(20) unsigned DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `user_name` varchar(255) NOT NULL,
  `skill` varchar(255) DEFAULT NULL,
  `role` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `image` varchar(255) DEFAULT NULL,
  `salary` decimal(10,2) NOT NULL,
  `password` varchar(255) NOT NULL,
  `remember_token` varchar(100) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `staff_user_name_unique` (`user_name`),
  UNIQUE KEY `staff_email_unique` (`email`),
  KEY `staff_shift_id_foreign` (`shift_id`),
  KEY `staff_branch_id_foreign` (`branch_id`),
  CONSTRAINT `staff_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  CONSTRAINT `staff_shift_id_foreign` FOREIGN KEY (`shift_id`) REFERENCES `shifts` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `staff` (`id`, `branch_id`, `shift_id`, `name`, `user_name`, `skill`, `role`, `email`, `image`, `salary`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES ('1', NULL, NULL, 'MOSHARRAF HOSSAIN', 'manager', 'Administration', 'Manager', 'icon@academy.com', NULL, '0.00', '$2y$12$jVLxOu.e.j/UXY7XaV42uubaESIkeWh4NlZiCPLddu0IbjuRxPNfu', NULL, '2026-10-15 06:03:07', '2026-10-15 06:03:07');
INSERT INTO `staff` (`id`, `branch_id`, `shift_id`, `name`, `user_name`, `skill`, `role`, `email`, `image`, `salary`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES ('3', '3', '3', 'Mohsin Miah', 'mohsin', 'Full-Time', 'Branch Manager', 'm@m.com', 'staffs/E4PSYCKOgoOnVTXUt65NApb5x7OkzXBZ8tD4g2v3.jpg', '20000.00', '$2y$12$P4lnXpYRsPSFz3UuWxPvhefsFpqkEFkltoznYFgLNA6KKSonEi/5K', NULL, '2026-10-16 11:19:16', '2026-10-16 11:19:16');
INSERT INTO `staff` (`id`, `branch_id`, `shift_id`, `name`, `user_name`, `skill`, `role`, `email`, `image`, `salary`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES ('4', '3', '3', 'Tapsina Hasneen', 'tapsinahasneen2002', 'Full-Time', 'Admin', 'tapsinahasneen2002@gmail.com', 'staffs/TTaFG4AgKoaVr0khgmt9g5yemSwGS5cfBvqmx6MX.png', '15000.00', '$2y$12$SwOFaFFccJAp4h.7d1OXP.EHm91lbRhFm0VkLTmBWBnftkwUJqiwO', NULL, '2026-10-16 11:21:47', '2026-10-16 11:21:47');
INSERT INTO `staff` (`id`, `branch_id`, `shift_id`, `name`, `user_name`, `skill`, `role`, `email`, `image`, `salary`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES ('5', '3', '3', 'Rina Ahmed', 'rina_32', 'Full-Time', 'Admin', 'rina@gmail.com', 'staffs/sPRUJeYCFrv1GL2zm6cux8J7sWAjuQe0GY1mFh16.png', '15000.00', '$2y$12$CsE6wFbUtNcJQkUsqQaw5uVrnU4wLmFTg03ALEOkW8jMeRM0mjF5K', NULL, '2026-10-16 11:23:03', '2026-10-16 11:23:03');
INSERT INTO `staff` (`id`, `branch_id`, `shift_id`, `name`, `user_name`, `skill`, `role`, `email`, `image`, `salary`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES ('6', '3', '3', 'Shariful Islam', 'sharif_23', 'Full-Time', 'Branch Accountant', 'sharif@gmail.com', 'staffs/uWLLChkcGyGiwENCXTHVLHzANHImob1oZzRqy5s1.jpg', '20000.00', '$2y$12$W61rUMNGZkjTxze4zVlBLOdtiKYA8aL7TBHcEfn1zjQUZsE9qDeuK', NULL, '2026-10-16 11:25:02', '2026-10-16 11:25:02');
INSERT INTO `staff` (`id`, `branch_id`, `shift_id`, `name`, `user_name`, `skill`, `role`, `email`, `image`, `salary`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES ('7', '4', '7', 'Subarna', 'subarna', 'Full-Time', 'Branch Manager', 'subarna@gmail.com', 'staffs/NjQT51k8dwTSmwoNePEDI0PDPt4W14khGv0pBruZ.png', '20000.00', '$2y$12$MGNNMrdXrUqp7sILNqIcd.2uJh.ikpJb8WkdBJbD9OvkkldCa.jia', NULL, '2026-10-16 17:04:26', '2026-10-16 17:35:15');


CREATE TABLE `staff_attendances` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `staff_id` bigint(20) unsigned NOT NULL,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `shift_name` varchar(255) NOT NULL DEFAULT 'General Shift',
  `date` date NOT NULL,
  `status` enum('Present','Absent','Late','Leave') NOT NULL DEFAULT 'Present',
  `in_time` time DEFAULT NULL,
  `out_time` time DEFAULT NULL,
  `note` text DEFAULT NULL,
  `leave` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `staff_attendances_staff_id_shift_name_date_unique` (`staff_id`,`shift_name`,`date`),
  KEY `staff_attendances_branch_id_foreign` (`branch_id`),
  CONSTRAINT `staff_attendances_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  CONSTRAINT `staff_attendances_staff_id_foreign` FOREIGN KEY (`staff_id`) REFERENCES `staff` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `staff_attendances` (`id`, `staff_id`, `branch_id`, `shift_name`, `date`, `status`, `in_time`, `out_time`, `note`, `leave`, `created_at`, `updated_at`) VALUES ('2', '5', '3', 'Staff Shift', '2026-10-16', 'Late', '18:39:00', NULL, 'Late by 579 mins', '0', '2026-10-16 12:39:39', '2026-10-16 12:39:39');
INSERT INTO `staff_attendances` (`id`, `staff_id`, `branch_id`, `shift_name`, `date`, `status`, `in_time`, `out_time`, `note`, `leave`, `created_at`, `updated_at`) VALUES ('3', '3', '3', 'Staff Shift', '2026-10-16', 'Late', '18:39:00', NULL, 'Late by 579 mins', '0', '2026-10-16 12:39:41', '2026-10-16 12:39:41');
INSERT INTO `staff_attendances` (`id`, `staff_id`, `branch_id`, `shift_name`, `date`, `status`, `in_time`, `out_time`, `note`, `leave`, `created_at`, `updated_at`) VALUES ('4', '6', '3', 'Staff Shift', '2026-10-16', 'Late', '18:39:00', NULL, 'Late by 579 mins', '0', '2026-10-16 12:39:44', '2026-10-16 12:39:44');
INSERT INTO `staff_attendances` (`id`, `staff_id`, `branch_id`, `shift_name`, `date`, `status`, `in_time`, `out_time`, `note`, `leave`, `created_at`, `updated_at`) VALUES ('5', '7', '4', 'Morning', '2026-10-16', 'Late', '23:32:00', NULL, 'Late by 872 mins', '0', '2026-10-16 17:32:54', '2026-10-16 17:32:54');


CREATE TABLE `student_attendances` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `student_id` bigint(20) unsigned NOT NULL,
  `student_session_id` bigint(20) unsigned DEFAULT NULL,
  `branch_id` bigint(20) unsigned NOT NULL,
  `date` date NOT NULL,
  `status` enum('present','absent','late','leave') NOT NULL DEFAULT 'present',
  `remarks` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `student_attendance_session_date_unique` (`student_session_id`,`date`),
  KEY `student_attendances_branch_id_foreign` (`branch_id`),
  KEY `student_attendances_student_id_index` (`student_id`),
  CONSTRAINT `student_attendances_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE CASCADE,
  CONSTRAINT `student_attendances_student_id_foreign` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE,
  CONSTRAINT `student_attendances_student_session_id_foreign` FOREIGN KEY (`student_session_id`) REFERENCES `student_sessions` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `student_attendances` (`id`, `student_id`, `student_session_id`, `branch_id`, `date`, `status`, `remarks`, `created_at`, `updated_at`) VALUES ('4', '5', '5', '3', '2026-10-16', 'present', NULL, '2026-10-16 12:28:06', '2026-10-16 12:28:06');
INSERT INTO `student_attendances` (`id`, `student_id`, `student_session_id`, `branch_id`, `date`, `status`, `remarks`, `created_at`, `updated_at`) VALUES ('5', '7', '7', '3', '2026-10-16', 'leave', NULL, '2026-10-16 12:30:20', '2026-10-16 12:30:47');
INSERT INTO `student_attendances` (`id`, `student_id`, `student_session_id`, `branch_id`, `date`, `status`, `remarks`, `created_at`, `updated_at`) VALUES ('6', '9', '9', '3', '2026-10-16', 'absent', NULL, '2026-10-16 12:31:29', '2026-10-16 12:31:29');
INSERT INTO `student_attendances` (`id`, `student_id`, `student_session_id`, `branch_id`, `date`, `status`, `remarks`, `created_at`, `updated_at`) VALUES ('7', '10', '10', '3', '2026-10-16', 'present', NULL, '2026-10-16 12:32:44', '2026-10-16 12:32:44');
INSERT INTO `student_attendances` (`id`, `student_id`, `student_session_id`, `branch_id`, `date`, `status`, `remarks`, `created_at`, `updated_at`) VALUES ('8', '12', '12', '4', '2026-10-16', 'present', NULL, '2026-10-16 17:24:41', '2026-10-16 17:24:41');


CREATE TABLE `student_sessions` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `student_id` bigint(20) unsigned NOT NULL,
  `academic_session_id` bigint(20) unsigned NOT NULL,
  `branch_id` bigint(20) unsigned NOT NULL,
  `class_id` bigint(20) unsigned NOT NULL,
  `section_id` bigint(20) unsigned NOT NULL,
  `shift_id` bigint(20) unsigned DEFAULT NULL,
  `class_group_id` bigint(20) unsigned DEFAULT NULL,
  `monthly_fee` decimal(10,2) NOT NULL DEFAULT 0.00,
  `status` enum('active','completed','transferred') NOT NULL DEFAULT 'active',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `student_session_unique` (`student_id`,`academic_session_id`),
  KEY `student_sessions_academic_session_id_foreign` (`academic_session_id`),
  KEY `student_sessions_class_id_foreign` (`class_id`),
  KEY `student_sessions_section_id_foreign` (`section_id`),
  KEY `student_sessions_shift_id_foreign` (`shift_id`),
  KEY `student_sessions_class_group_id_foreign` (`class_group_id`),
  KEY `student_sessions_branch_id_academic_session_id_index` (`branch_id`,`academic_session_id`),
  CONSTRAINT `student_sessions_academic_session_id_foreign` FOREIGN KEY (`academic_session_id`) REFERENCES `academic_sessions` (`id`) ON DELETE CASCADE,
  CONSTRAINT `student_sessions_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE CASCADE,
  CONSTRAINT `student_sessions_class_group_id_foreign` FOREIGN KEY (`class_group_id`) REFERENCES `class_groups` (`id`) ON DELETE SET NULL,
  CONSTRAINT `student_sessions_class_id_foreign` FOREIGN KEY (`class_id`) REFERENCES `clss_m_s` (`id`),
  CONSTRAINT `student_sessions_section_id_foreign` FOREIGN KEY (`section_id`) REFERENCES `sections` (`id`),
  CONSTRAINT `student_sessions_shift_id_foreign` FOREIGN KEY (`shift_id`) REFERENCES `shifts` (`id`) ON DELETE SET NULL,
  CONSTRAINT `student_sessions_student_id_foreign` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `student_sessions` (`id`, `student_id`, `academic_session_id`, `branch_id`, `class_id`, `section_id`, `shift_id`, `class_group_id`, `monthly_fee`, `status`, `created_at`, `updated_at`) VALUES ('5', '5', '3', '3', '3', '3', '4', '2', '2000.00', 'active', '2026-10-16 11:48:20', '2026-10-16 11:48:20');
INSERT INTO `student_sessions` (`id`, `student_id`, `academic_session_id`, `branch_id`, `class_id`, `section_id`, `shift_id`, `class_group_id`, `monthly_fee`, `status`, `created_at`, `updated_at`) VALUES ('6', '6', '3', '3', '3', '3', '4', '2', '2000.00', 'active', '2026-10-16 11:51:09', '2026-10-16 12:15:23');
INSERT INTO `student_sessions` (`id`, `student_id`, `academic_session_id`, `branch_id`, `class_id`, `section_id`, `shift_id`, `class_group_id`, `monthly_fee`, `status`, `created_at`, `updated_at`) VALUES ('7', '7', '3', '3', '3', '3', '4', '2', '2000.00', 'active', '2026-10-16 11:52:33', '2026-10-16 11:52:33');
INSERT INTO `student_sessions` (`id`, `student_id`, `academic_session_id`, `branch_id`, `class_id`, `section_id`, `shift_id`, `class_group_id`, `monthly_fee`, `status`, `created_at`, `updated_at`) VALUES ('8', '8', '3', '3', '4', '3', '5', '2', '2000.00', 'active', '2026-10-16 12:17:25', '2026-10-16 12:17:25');
INSERT INTO `student_sessions` (`id`, `student_id`, `academic_session_id`, `branch_id`, `class_id`, `section_id`, `shift_id`, `class_group_id`, `monthly_fee`, `status`, `created_at`, `updated_at`) VALUES ('9', '9', '3', '3', '4', '3', '4', '2', '2000.00', 'active', '2026-10-16 12:19:18', '2026-10-16 12:19:18');
INSERT INTO `student_sessions` (`id`, `student_id`, `academic_session_id`, `branch_id`, `class_id`, `section_id`, `shift_id`, `class_group_id`, `monthly_fee`, `status`, `created_at`, `updated_at`) VALUES ('10', '10', '3', '3', '4', '3', '4', '2', '2000.00', 'active', '2026-10-16 12:22:09', '2026-10-16 12:22:09');
INSERT INTO `student_sessions` (`id`, `student_id`, `academic_session_id`, `branch_id`, `class_id`, `section_id`, `shift_id`, `class_group_id`, `monthly_fee`, `status`, `created_at`, `updated_at`) VALUES ('11', '11', '4', '3', '4', '5', '5', '2', '2000.00', 'active', '2026-10-16 12:56:47', '2026-10-16 12:56:47');
INSERT INTO `student_sessions` (`id`, `student_id`, `academic_session_id`, `branch_id`, `class_id`, `section_id`, `shift_id`, `class_group_id`, `monthly_fee`, `status`, `created_at`, `updated_at`) VALUES ('12', '12', '5', '4', '5', '6', '7', '3', '2000.00', 'active', '2026-10-16 17:23:47', '2026-10-16 18:09:47');


CREATE TABLE `students` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `section_id` bigint(20) unsigned NOT NULL,
  `shift_id` bigint(20) unsigned DEFAULT NULL,
  `class_id` bigint(20) unsigned NOT NULL,
  `class_group_id` bigint(20) unsigned DEFAULT NULL,
  `full_name` varchar(255) NOT NULL,
  `version` varchar(255) DEFAULT NULL,
  `fathers_name` varchar(255) NOT NULL,
  `mothers_name` varchar(255) NOT NULL,
  `student_id` varchar(255) NOT NULL,
  `phone` varchar(255) NOT NULL,
  `email` varchar(255) DEFAULT NULL,
  `course_name` varchar(255) DEFAULT NULL,
  `image` varchar(255) DEFAULT NULL,
  `admission_date` date DEFAULT NULL,
  `status` enum('active','inactive') NOT NULL DEFAULT 'active',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `monthly_fee` decimal(10,2) DEFAULT NULL,
  `student_roll` varchar(255) DEFAULT NULL,
  `second_phone` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `students_student_id_unique` (`student_id`),
  KEY `students_section_id_foreign` (`section_id`),
  KEY `students_shift_id_foreign` (`shift_id`),
  KEY `students_class_id_foreign` (`class_id`),
  KEY `students_class_group_id_foreign` (`class_group_id`),
  KEY `students_branch_id_foreign` (`branch_id`),
  CONSTRAINT `students_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  CONSTRAINT `students_class_group_id_foreign` FOREIGN KEY (`class_group_id`) REFERENCES `class_groups` (`id`) ON DELETE SET NULL,
  CONSTRAINT `students_class_id_foreign` FOREIGN KEY (`class_id`) REFERENCES `clss_m_s` (`id`) ON DELETE CASCADE,
  CONSTRAINT `students_section_id_foreign` FOREIGN KEY (`section_id`) REFERENCES `sections` (`id`) ON DELETE CASCADE,
  CONSTRAINT `students_shift_id_foreign` FOREIGN KEY (`shift_id`) REFERENCES `shifts` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `students` (`id`, `branch_id`, `section_id`, `shift_id`, `class_id`, `class_group_id`, `full_name`, `version`, `fathers_name`, `mothers_name`, `student_id`, `phone`, `email`, `course_name`, `image`, `admission_date`, `status`, `created_at`, `updated_at`, `monthly_fee`, `student_roll`, `second_phone`) VALUES ('5', '3', '3', '4', '3', '2', 'Tashrif Ahmed', 'Bangla Medium (Special Care)', 'Shahidul Islam', 'Taskiya Tanzin', 'STD-1001', '01753787564', 'tashrif@gmail.com', NULL, 'students/1792151300_PFrI4DaWPz.png', '2026-10-16', 'active', '2026-10-16 11:48:20', '2026-10-16 11:48:20', '2000.00', '01', '01979787564');
INSERT INTO `students` (`id`, `branch_id`, `section_id`, `shift_id`, `class_id`, `class_group_id`, `full_name`, `version`, `fathers_name`, `mothers_name`, `student_id`, `phone`, `email`, `course_name`, `image`, `admission_date`, `status`, `created_at`, `updated_at`, `monthly_fee`, `student_roll`, `second_phone`) VALUES ('6', '3', '3', '4', '3', '2', 'Ashraful Haque', 'Bangla Medium (Special Care)', 'Ashraf\'s Father', 'Ashraf\'s Mother', 'STD-1002', '01987678465', 'ashraf@gmail.com', NULL, 'students/1792152923_JtVFGYuG8Y.png', '2026-10-16', 'active', '2026-10-16 11:51:09', '2026-10-16 12:15:23', '2000.00', '02', '01325467568');
INSERT INTO `students` (`id`, `branch_id`, `section_id`, `shift_id`, `class_id`, `class_group_id`, `full_name`, `version`, `fathers_name`, `mothers_name`, `student_id`, `phone`, `email`, `course_name`, `image`, `admission_date`, `status`, `created_at`, `updated_at`, `monthly_fee`, `student_roll`, `second_phone`) VALUES ('7', '3', '3', '4', '3', '2', 'Mosharraf Hossain', 'Bangla Medium (Special Care)', 'Mosharraf\'s Father', 'Mosharraf\'s Mother', 'STD-1003', '01987783432', 'mosharraf@gmail.com', NULL, 'students/1792151553_Cnno20WIf2.png', '2026-10-16', 'active', '2026-10-16 11:52:33', '2026-10-16 11:52:33', '2000.00', '03', '01898097096');
INSERT INTO `students` (`id`, `branch_id`, `section_id`, `shift_id`, `class_id`, `class_group_id`, `full_name`, `version`, `fathers_name`, `mothers_name`, `student_id`, `phone`, `email`, `course_name`, `image`, `admission_date`, `status`, `created_at`, `updated_at`, `monthly_fee`, `student_roll`, `second_phone`) VALUES ('8', '3', '3', '5', '4', '2', 'Shahidul Islam', 'Bangla Medium (Special Care)', 'Ataur Rahman', 'Johura Begum', 'STD-1004', '01754389785', 'shahed@gmail.com', NULL, 'students/1792153045_JmLMBZMaiE.jpeg', '2026-10-16', 'active', '2026-10-16 12:17:25', '2026-10-16 12:17:25', '2000.00', '01', '01989876556');
INSERT INTO `students` (`id`, `branch_id`, `section_id`, `shift_id`, `class_id`, `class_group_id`, `full_name`, `version`, `fathers_name`, `mothers_name`, `student_id`, `phone`, `email`, `course_name`, `image`, `admission_date`, `status`, `created_at`, `updated_at`, `monthly_fee`, `student_roll`, `second_phone`) VALUES ('9', '3', '3', '4', '4', '2', 'Taskiya Tanzin', 'Bangla Medium (Special Care)', 'Kabir Hossain', 'Taskiya\'s Ammu', 'STD-1005', '01918736456', 'taskiya@gmail.com', NULL, 'students/1792153158_qZ9unXeSPf.png', '2026-10-16', 'active', '2026-10-16 12:19:18', '2026-10-16 12:19:18', '2000.00', '02', '01987465748');
INSERT INTO `students` (`id`, `branch_id`, `section_id`, `shift_id`, `class_id`, `class_group_id`, `full_name`, `version`, `fathers_name`, `mothers_name`, `student_id`, `phone`, `email`, `course_name`, `image`, `admission_date`, `status`, `created_at`, `updated_at`, `monthly_fee`, `student_roll`, `second_phone`) VALUES ('10', '3', '3', '4', '4', '2', 'Tawhid Islam Rafi', 'Bangla Medium (Special Care)', 'Kabir Hossain', 'Rafi\'s Ammu', 'STD-1006', '01989877667', 'rafi@gmail.com', NULL, 'students/1792153329_PAoBwqCIyH.png', '2026-09-16', 'active', '2026-09-16 12:22:09', '2026-09-16 12:22:09', '2000.00', '03', '01980989008');
INSERT INTO `students` (`id`, `branch_id`, `section_id`, `shift_id`, `class_id`, `class_group_id`, `full_name`, `version`, `fathers_name`, `mothers_name`, `student_id`, `phone`, `email`, `course_name`, `image`, `admission_date`, `status`, `created_at`, `updated_at`, `monthly_fee`, `student_roll`, `second_phone`) VALUES ('11', '3', '5', '5', '4', '2', 'asdf', 'Bangla Medium (Special Care)', 'asdf', 'asdf', 'STD-1007', '234', 'asadulislamgoos@gmail.com', NULL, NULL, '2025-09-16', 'active', '2025-09-01 12:56:47', '2025-09-01 12:56:47', '2000.00', '234', '879');
INSERT INTO `students` (`id`, `branch_id`, `section_id`, `shift_id`, `class_id`, `class_group_id`, `full_name`, `version`, `fathers_name`, `mothers_name`, `student_id`, `phone`, `email`, `course_name`, `image`, `admission_date`, `status`, `created_at`, `updated_at`, `monthly_fee`, `student_roll`, `second_phone`) VALUES ('12', '4', '6', '7', '5', '3', 'TASHRIF AHMED', 'Bangla Medium (Special Care)', 'Shahidul Islam', 'Taskiya Tanzin', 'STD-1008', '01753787564', 'tashrif2@gmail.com', NULL, 'students/1792174300_MDhkAnBAcb.jpeg', '2026-10-16', 'active', '2026-10-16 17:23:47', '2026-10-16 18:14:31', '2000.00', '01', '01979787564');


CREATE TABLE `subjects` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `code` varchar(50) NOT NULL,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `full_mark` int(10) unsigned NOT NULL DEFAULT 100,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `subjects_branch_id_code_unique` (`branch_id`,`code`),
  CONSTRAINT `subjects_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `subjects` (`id`, `name`, `code`, `branch_id`, `full_mark`, `created_at`, `updated_at`) VALUES ('8', 'Bangla', 'BANGLA', '3', '100', '2026-10-16 11:41:34', '2026-10-16 11:41:34');
INSERT INTO `subjects` (`id`, `name`, `code`, `branch_id`, `full_mark`, `created_at`, `updated_at`) VALUES ('9', 'English', 'ENG', '3', '100', '2026-10-16 11:42:04', '2026-10-16 11:42:04');
INSERT INTO `subjects` (`id`, `name`, `code`, `branch_id`, `full_mark`, `created_at`, `updated_at`) VALUES ('10', 'Mathematics', 'MATH', '3', '100', '2026-10-16 11:42:30', '2026-10-16 11:42:30');
INSERT INTO `subjects` (`id`, `name`, `code`, `branch_id`, `full_mark`, `created_at`, `updated_at`) VALUES ('11', 'Bangladesh & Global Studies', 'BGS', '3', '100', '2026-10-16 11:42:49', '2026-10-16 11:42:49');
INSERT INTO `subjects` (`id`, `name`, `code`, `branch_id`, `full_mark`, `created_at`, `updated_at`) VALUES ('12', 'Science', 'SCE', '3', '100', '2026-10-16 11:42:58', '2026-10-16 11:42:58');
INSERT INTO `subjects` (`id`, `name`, `code`, `branch_id`, `full_mark`, `created_at`, `updated_at`) VALUES ('13', 'Religion', 'REL', '3', '100', '2026-10-16 11:43:09', '2026-10-16 11:43:09');
INSERT INTO `subjects` (`id`, `name`, `code`, `branch_id`, `full_mark`, `created_at`, `updated_at`) VALUES ('14', 'Agriculture', 'AGRI', '3', '100', '2026-10-16 11:43:24', '2026-10-16 11:43:24');
INSERT INTO `subjects` (`id`, `name`, `code`, `branch_id`, `full_mark`, `created_at`, `updated_at`) VALUES ('15', 'Bangla', 'BANG', '4', '100', '2026-10-16 17:19:16', '2026-10-16 17:19:16');
INSERT INTO `subjects` (`id`, `name`, `code`, `branch_id`, `full_mark`, `created_at`, `updated_at`) VALUES ('16', 'Math', 'MATH', '4', '100', '2026-10-16 17:19:27', '2026-10-16 17:19:27');
INSERT INTO `subjects` (`id`, `name`, `code`, `branch_id`, `full_mark`, `created_at`, `updated_at`) VALUES ('17', 'English', 'ENG', '4', '100', '2026-10-16 17:19:34', '2026-10-16 17:19:34');
INSERT INTO `subjects` (`id`, `name`, `code`, `branch_id`, `full_mark`, `created_at`, `updated_at`) VALUES ('18', 'Bangladesh & Global Studies', 'BGS', '4', '100', '2026-10-16 17:19:52', '2026-10-16 17:19:52');
INSERT INTO `subjects` (`id`, `name`, `code`, `branch_id`, `full_mark`, `created_at`, `updated_at`) VALUES ('19', 'Science', 'SCE', '4', '100', '2026-10-16 17:20:02', '2026-10-16 17:20:02');
INSERT INTO `subjects` (`id`, `name`, `code`, `branch_id`, `full_mark`, `created_at`, `updated_at`) VALUES ('20', 'Religion', 'REL', '4', '100', '2026-10-16 17:20:11', '2026-10-16 17:20:11');
INSERT INTO `subjects` (`id`, `name`, `code`, `branch_id`, `full_mark`, `created_at`, `updated_at`) VALUES ('21', 'Krishi', 'KRISHI', '4', '100', '2026-10-16 17:20:21', '2026-10-16 17:20:21');


CREATE TABLE `teacher_shift` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `teacher_id` bigint(20) unsigned NOT NULL,
  `shift_id` bigint(20) unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `teacher_shift_teacher_id_foreign` (`teacher_id`),
  KEY `teacher_shift_shift_id_foreign` (`shift_id`),
  CONSTRAINT `teacher_shift_shift_id_foreign` FOREIGN KEY (`shift_id`) REFERENCES `shifts` (`id`) ON DELETE CASCADE,
  CONSTRAINT `teacher_shift_teacher_id_foreign` FOREIGN KEY (`teacher_id`) REFERENCES `teachers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `teacher_shift` (`id`, `teacher_id`, `shift_id`, `created_at`, `updated_at`) VALUES ('3', '3', '4', NULL, NULL);
INSERT INTO `teacher_shift` (`id`, `teacher_id`, `shift_id`, `created_at`, `updated_at`) VALUES ('4', '2', '4', NULL, NULL);
INSERT INTO `teacher_shift` (`id`, `teacher_id`, `shift_id`, `created_at`, `updated_at`) VALUES ('5', '4', '4', NULL, NULL);
INSERT INTO `teacher_shift` (`id`, `teacher_id`, `shift_id`, `created_at`, `updated_at`) VALUES ('6', '5', '4', NULL, NULL);


CREATE TABLE `teachers` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `teacher_id` varchar(255) NOT NULL,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `full_name` varchar(255) NOT NULL,
  `designation` varchar(255) NOT NULL,
  `department` varchar(255) NOT NULL,
  `qualification` varchar(255) DEFAULT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `email` varchar(255) NOT NULL,
  `join_date` date NOT NULL,
  `salary` decimal(10,2) NOT NULL,
  `image` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `teachers_teacher_id_unique` (`teacher_id`),
  UNIQUE KEY `teachers_email_unique` (`email`),
  KEY `teachers_branch_id_foreign` (`branch_id`),
  CONSTRAINT `teachers_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `teachers` (`id`, `teacher_id`, `branch_id`, `full_name`, `designation`, `department`, `qualification`, `phone`, `email`, `join_date`, `salary`, `image`, `created_at`, `updated_at`) VALUES ('2', 'TCH-1001', '3', 'Kohinoor Begum', 'Senior Teacher', 'English', 'HSC', '019106381', 'kohiroor@gmail.com', '2026-10-16', '2000.00', 'teachers/1792150092_chnDmLeUsz.png', '2026-10-16 11:28:12', '2026-10-16 11:28:12');
INSERT INTO `teachers` (`id`, `teacher_id`, `branch_id`, `full_name`, `designation`, `department`, `qualification`, `phone`, `email`, `join_date`, `salary`, `image`, `created_at`, `updated_at`) VALUES ('3', 'TCH-1002', '3', 'Layla Parvin', 'Senior Teacher', 'Mathematics', 'MA', '01989877889', 'layla@gmail.com', '2026-10-16', '2000.00', 'teachers/1792150251_zBeTfI0sE2.png', '2026-10-16 11:30:51', '2026-10-16 11:30:51');
INSERT INTO `teachers` (`id`, `teacher_id`, `branch_id`, `full_name`, `designation`, `department`, `qualification`, `phone`, `email`, `join_date`, `salary`, `image`, `created_at`, `updated_at`) VALUES ('4', 'TCH-1003', '3', 'Rifat Hossen', 'Senior Teacher', 'Electrical Engineering', 'MA in Sce', '01936475896', 'rifat@gmail.com', '2026-10-16', '2000.00', 'teachers/1792150372_F1ffXf0T18.png', '2026-10-16 11:32:52', '2026-10-16 11:32:52');
INSERT INTO `teachers` (`id`, `teacher_id`, `branch_id`, `full_name`, `designation`, `department`, `qualification`, `phone`, `email`, `join_date`, `salary`, `image`, `created_at`, `updated_at`) VALUES ('5', 'TCH-1004', '3', 'Kamrul Hasan', 'Senior Teacher', 'English', 'MA', '01787659098', 'kamrul@gmail.com', '2026-10-16', '2000.00', 'teachers/1792150602_AJZHrw2X1o.jpeg', '2026-10-16 11:36:42', '2026-10-16 11:36:42');


CREATE TABLE `teachers_attendances` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `teacher_id` bigint(20) unsigned NOT NULL,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `shift_name` varchar(255) NOT NULL DEFAULT 'General Shift',
  `date` date NOT NULL,
  `status` enum('Present','Absent','Late','Leave') NOT NULL DEFAULT 'Present',
  `leave` tinyint(1) NOT NULL DEFAULT 0,
  `in_time` time DEFAULT NULL,
  `out_time` time DEFAULT NULL,
  `note` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `teachers_attendances_teacher_id_shift_name_date_unique` (`teacher_id`,`shift_name`,`date`),
  KEY `teachers_attendances_branch_id_foreign` (`branch_id`),
  CONSTRAINT `teachers_attendances_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  CONSTRAINT `teachers_attendances_teacher_id_foreign` FOREIGN KEY (`teacher_id`) REFERENCES `teachers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `teachers_attendances` (`id`, `teacher_id`, `branch_id`, `shift_name`, `date`, `status`, `leave`, `in_time`, `out_time`, `note`, `created_at`, `updated_at`) VALUES ('2', '5', '3', 'Morning', '2026-10-16', 'Late', '0', '09:35:00', '12:00:00', 'Late by 35 mins', '2026-10-16 12:35:01', '2026-10-16 12:37:15');
INSERT INTO `teachers_attendances` (`id`, `teacher_id`, `branch_id`, `shift_name`, `date`, `status`, `leave`, `in_time`, `out_time`, `note`, `created_at`, `updated_at`) VALUES ('3', '2', '3', 'Morning', '2026-10-16', 'Late', '0', '18:35:00', NULL, 'Late by 575 mins', '2026-10-16 12:35:17', '2026-10-16 12:35:17');
INSERT INTO `teachers_attendances` (`id`, `teacher_id`, `branch_id`, `shift_name`, `date`, `status`, `leave`, `in_time`, `out_time`, `note`, `created_at`, `updated_at`) VALUES ('4', '4', '3', 'Morning', '2026-10-16', 'Present', '0', '09:00:00', '12:00:00', NULL, '2026-10-16 12:35:41', '2026-10-16 12:36:16');
INSERT INTO `teachers_attendances` (`id`, `teacher_id`, `branch_id`, `shift_name`, `date`, `status`, `leave`, `in_time`, `out_time`, `note`, `created_at`, `updated_at`) VALUES ('5', '3', '3', 'Morning', '2026-10-16', 'Absent', '0', NULL, NULL, NULL, '2026-10-16 12:37:58', '2026-10-16 12:38:17');


CREATE TABLE `users` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `email_verified_at` timestamp NULL DEFAULT NULL,
  `password` varchar(255) NOT NULL,
  `remember_token` varchar(100) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `users_email_unique` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

