-- https://www.phpmyadmin.net/
--
-- Anamakine: 127.0.0.1
-- Üretim Zamanı: 04 Tem 2026, 22:08:06
-- Sunucu sürümü: 10.4.32-MariaDB
-- PHP Sürümü: 8.2.12

START TRANSACTION;



--
-- Veritabanı: `kolayabonelik`
--

-- --------------------------------------------------------

--
-- Tablo için tablo yapısı `activity_logs`
--

CREATE TABLE `activity_logs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `log_name` varchar(255) DEFAULT NULL,
  `description` text NOT NULL,
  `subject_type` varchar(255) DEFAULT NULL,
  `subject_id` bigint(20) UNSIGNED DEFAULT NULL,
  `event` varchar(255) DEFAULT NULL,
  `causer_type` varchar(255) DEFAULT NULL,
  `causer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `properties` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`properties`)),
  `batch_uuid` char(36) DEFAULT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Tablo döküm verisi `activity_logs`
--

INSERT INTO `activity_logs` (`id`, `log_name`, `description`, `subject_type`, `subject_id`, `event`, `causer_type`, `causer_id`, `properties`, `batch_uuid`, `ip_address`, `user_agent`, `created_at`, `updated_at`) VALUES
(1, 'companies', 'created', 'App\\Models\\Company', 1, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"T\\u00fcrk Telekom\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(2, 'companies', 'created', 'App\\Models\\Company', 2, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"Vodafone\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(3, 'companies', 'created', 'App\\Models\\Company', 3, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"Turkcell\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(4, 'companies', 'created', 'App\\Models\\Company', 4, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"D-Smart\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(5, 'companies', 'created', 'App\\Models\\Company', 5, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"T\\u00fcrkNet\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(6, 'companies', 'created', 'App\\Models\\Company', 6, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"Millenicom\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(7, 'companies', 'created', 'App\\Models\\Company', 7, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"KabloNet\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(8, 'packages', 'created', 'App\\Models\\Package', 1, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"T\\u00fcrk Telekom 50 Mbps Paketi\",\"monthly_fee\":\"199.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(9, 'packages', 'created', 'App\\Models\\Package', 2, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"T\\u00fcrk Telekom 100 Mbps Paketi\",\"monthly_fee\":\"299.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(10, 'packages', 'created', 'App\\Models\\Package', 3, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"T\\u00fcrk Telekom 250 Mbps Paketi\",\"monthly_fee\":\"399.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(11, 'packages', 'created', 'App\\Models\\Package', 4, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"T\\u00fcrk Telekom 500 Mbps Paketi\",\"monthly_fee\":\"499.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(12, 'packages', 'created', 'App\\Models\\Package', 5, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"Vodafone 50 Mbps Paketi\",\"monthly_fee\":\"199.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(13, 'packages', 'created', 'App\\Models\\Package', 6, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"Vodafone 100 Mbps Paketi\",\"monthly_fee\":\"299.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(14, 'packages', 'created', 'App\\Models\\Package', 7, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"Vodafone 250 Mbps Paketi\",\"monthly_fee\":\"399.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(15, 'packages', 'created', 'App\\Models\\Package', 8, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"Vodafone 500 Mbps Paketi\",\"monthly_fee\":\"499.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(16, 'packages', 'created', 'App\\Models\\Package', 9, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"Turkcell 50 Mbps Paketi\",\"monthly_fee\":\"199.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(17, 'packages', 'created', 'App\\Models\\Package', 10, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"Turkcell 100 Mbps Paketi\",\"monthly_fee\":\"299.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(18, 'packages', 'created', 'App\\Models\\Package', 11, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"Turkcell 250 Mbps Paketi\",\"monthly_fee\":\"399.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(19, 'packages', 'created', 'App\\Models\\Package', 12, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"Turkcell 500 Mbps Paketi\",\"monthly_fee\":\"499.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(20, 'packages', 'created', 'App\\Models\\Package', 13, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"D-Smart 50 Mbps Paketi\",\"monthly_fee\":\"199.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(21, 'packages', 'created', 'App\\Models\\Package', 14, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"D-Smart 100 Mbps Paketi\",\"monthly_fee\":\"299.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(22, 'packages', 'created', 'App\\Models\\Package', 15, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"D-Smart 250 Mbps Paketi\",\"monthly_fee\":\"399.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(23, 'packages', 'created', 'App\\Models\\Package', 16, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"D-Smart 500 Mbps Paketi\",\"monthly_fee\":\"499.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(24, 'packages', 'created', 'App\\Models\\Package', 17, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"T\\u00fcrkNet 50 Mbps Paketi\",\"monthly_fee\":\"199.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(25, 'packages', 'created', 'App\\Models\\Package', 18, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"T\\u00fcrkNet 100 Mbps Paketi\",\"monthly_fee\":\"299.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(26, 'packages', 'created', 'App\\Models\\Package', 19, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"T\\u00fcrkNet 250 Mbps Paketi\",\"monthly_fee\":\"399.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(27, 'packages', 'created', 'App\\Models\\Package', 20, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"T\\u00fcrkNet 500 Mbps Paketi\",\"monthly_fee\":\"499.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(28, 'packages', 'created', 'App\\Models\\Package', 21, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"Millenicom 50 Mbps Paketi\",\"monthly_fee\":\"199.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(29, 'packages', 'created', 'App\\Models\\Package', 22, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"Millenicom 100 Mbps Paketi\",\"monthly_fee\":\"299.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(30, 'packages', 'created', 'App\\Models\\Package', 23, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"Millenicom 250 Mbps Paketi\",\"monthly_fee\":\"399.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(31, 'packages', 'created', 'App\\Models\\Package', 24, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"Millenicom 500 Mbps Paketi\",\"monthly_fee\":\"499.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(32, 'packages', 'created', 'App\\Models\\Package', 25, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"KabloNet 50 Mbps Paketi\",\"monthly_fee\":\"199.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(33, 'packages', 'created', 'App\\Models\\Package', 26, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"KabloNet 100 Mbps Paketi\",\"monthly_fee\":\"299.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(34, 'packages', 'created', 'App\\Models\\Package', 27, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"KabloNet 250 Mbps Paketi\",\"monthly_fee\":\"399.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(35, 'packages', 'created', 'App\\Models\\Package', 28, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"KabloNet 500 Mbps Paketi\",\"monthly_fee\":\"499.00\",\"status\":\"active\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(36, 'users', 'created', 'App\\Models\\User', 1, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"Master Admin\",\"email\":\"admin@kolayabonelik.com\",\"status\":\"active\",\"dealer_id\":null}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(37, 'users', 'created', 'App\\Models\\User', 2, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"Ahmet Y\\u0131lmaz\",\"email\":\"satisbayi@kolayabonelik.com\",\"status\":\"active\",\"dealer_id\":null}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(38, 'dealers', 'created', 'App\\Models\\Dealer', 1, 'created', NULL, NULL, '{\"attributes\":{\"company_name\":\"Y\\u0131lmaz Telekom Bayii\",\"status\":\"active\",\"type\":\"sales\"}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(39, 'users', 'updated', 'App\\Models\\User', 2, 'updated', NULL, NULL, '{\"attributes\":{\"dealer_id\":1},\"old\":{\"dealer_id\":null}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(40, 'users', 'created', 'App\\Models\\User', 3, 'created', NULL, NULL, '{\"attributes\":{\"name\":\"Elif Demir\",\"email\":\"icerikbayi@kolayabonelik.com\",\"status\":\"active\",\"dealer_id\":null}}', NULL, NULL, NULL, '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(41, 'dealers', 'created', 'App\\Models\\Dealer', 2, 'created', NULL, NULL, '{\"attributes\":{\"company_name\":\"Demir Medya\",\"status\":\"active\",\"type\":\"content\"}}', NULL, NULL, NULL, '2026-07-04 15:04:28', '2026-07-04 15:04:28'),
(42, 'users', 'updated', 'App\\Models\\User', 3, 'updated', NULL, NULL, '{\"attributes\":{\"dealer_id\":2},\"old\":{\"dealer_id\":null}}', NULL, NULL, NULL, '2026-07-04 15:04:28', '2026-07-04 15:04:28'),
(43, 'users', 'updated', 'App\\Models\\User', 1, 'updated', 'App\\Models\\User', 1, '{\"attributes\":[],\"old\":[]}', NULL, NULL, NULL, '2026-07-04 15:17:24', '2026-07-04 15:17:24'),
(44, 'auth', 'Kullanıcı giriş yaptı.', NULL, NULL, NULL, 'App\\Models\\User', 1, '[]', NULL, NULL, NULL, '2026-07-04 15:17:24', '2026-07-04 15:17:24'),
(45, 'users', 'updated', 'App\\Models\\User', 2, 'updated', 'App\\Models\\User', 2, '{\"attributes\":[],\"old\":[]}', NULL, NULL, NULL, '2026-07-04 15:26:07', '2026-07-04 15:26:07'),
(46, 'auth', 'Kullanıcı giriş yaptı.', NULL, NULL, NULL, 'App\\Models\\User', 2, '[]', NULL, NULL, NULL, '2026-07-04 15:26:07', '2026-07-04 15:26:07'),
(47, 'subscriptions', 'created', 'App\\Models\\Subscription', 1, 'created', 'App\\Models\\User', 2, '{\"attributes\":{\"status\":\"draft\",\"dealer_id\":1,\"package_id\":1}}', NULL, NULL, NULL, '2026-07-04 15:30:05', '2026-07-04 15:30:05'),
(48, 'subscriptions', 'updated', 'App\\Models\\Subscription', 1, 'updated', 'App\\Models\\User', 1, '{\"attributes\":{\"status\":\"completed\"},\"old\":{\"status\":\"draft\"}}', NULL, NULL, NULL, '2026-07-04 15:30:25', '2026-07-04 15:30:25'),
(51, 'auth', 'Kullanıcı çıkış yaptı.', NULL, NULL, NULL, 'App\\Models\\User', 1, '[]', NULL, NULL, NULL, '2026-07-04 15:43:49', '2026-07-04 15:43:49'),
(52, 'users', 'updated', 'App\\Models\\User', 2, 'updated', 'App\\Models\\User', 2, '{\"attributes\":[],\"old\":[]}', NULL, NULL, NULL, '2026-07-04 15:44:10', '2026-07-04 15:44:10'),
(53, 'auth', 'Kullanıcı giriş yaptı.', NULL, NULL, NULL, 'App\\Models\\User', 2, '[]', NULL, NULL, NULL, '2026-07-04 15:44:10', '2026-07-04 15:44:10'),
(54, 'subscriptions', 'created', 'App\\Models\\Subscription', 2, 'created', 'App\\Models\\User', 2, '{\"attributes\":{\"status\":\"draft\",\"dealer_id\":1,\"package_id\":1}}', NULL, NULL, NULL, '2026-07-04 15:51:33', '2026-07-04 15:51:33'),
(55, 'auth', 'Kullanıcı çıkış yaptı.', NULL, NULL, NULL, 'App\\Models\\User', 2, '[]', NULL, NULL, NULL, '2026-07-04 15:51:52', '2026-07-04 15:51:52'),
(56, 'users', 'updated', 'App\\Models\\User', 1, 'updated', 'App\\Models\\User', 1, '{\"attributes\":[],\"old\":[]}', NULL, NULL, NULL, '2026-07-04 15:52:07', '2026-07-04 15:52:07'),
(57, 'auth', 'Kullanıcı giriş yaptı.', NULL, NULL, NULL, 'App\\Models\\User', 1, '[]', NULL, NULL, NULL, '2026-07-04 15:52:07', '2026-07-04 15:52:07'),
(58, 'subscriptions', 'updated', 'App\\Models\\Subscription', 2, 'updated', 'App\\Models\\User', 1, '{\"attributes\":{\"status\":\"completed\"},\"old\":{\"status\":\"draft\"}}', NULL, NULL, NULL, '2026-07-04 15:52:26', '2026-07-04 15:52:26'),
(59, 'earnings', 'created', 'App\\Models\\Earning', 2, 'created', 'App\\Models\\User', 1, '{\"attributes\":{\"total_amount\":\"238.80\",\"status\":\"pending\"}}', NULL, NULL, NULL, '2026-07-04 15:52:26', '2026-07-04 15:52:26'),
(60, 'earnings', 'Abonelik tamamlandı, hakediş otomatik hesaplandı.', 'App\\Models\\Earning', 2, NULL, 'App\\Models\\User', 1, '{\"subscription_id\":2,\"amount\":238.8}', NULL, NULL, NULL, '2026-07-04 15:52:26', '2026-07-04 15:52:26'),
(61, 'payments', 'created', 'App\\Models\\Payment', 1, 'created', 'App\\Models\\User', 1, '{\"attributes\":{\"amount\":\"238.00\",\"payment_type\":\"havale\",\"dealer_id\":1}}', NULL, NULL, NULL, '2026-07-04 15:57:55', '2026-07-04 15:57:55'),
(62, 'applications', 'created', 'App\\Models\\Application', 1, 'created', 'App\\Models\\User', 2, '{\"attributes\":{\"status\":\"new\",\"assigned_dealer_id\":null}}', NULL, NULL, NULL, '2026-07-04 16:30:25', '2026-07-04 16:30:25'),
(63, 'dealers', 'created', 'App\\Models\\Dealer', 3, 'created', NULL, NULL, '{\"attributes\":{\"company_name\":\"Master Admin\",\"status\":\"active\",\"type\":\"sales\"}}', NULL, NULL, NULL, '2026-07-04 16:44:42', '2026-07-04 16:44:42'),
(64, 'applications', 'updated', 'App\\Models\\Application', 1, 'updated', 'App\\Models\\User', 1, '{\"attributes\":{\"assigned_dealer_id\":3},\"old\":{\"assigned_dealer_id\":null}}', NULL, NULL, NULL, '2026-07-04 16:45:06', '2026-07-04 16:45:06'),
(65, 'subscriptions', 'created', 'App\\Models\\Subscription', 3, 'created', 'App\\Models\\User', 1, '{\"attributes\":{\"status\":\"pending\",\"dealer_id\":3,\"package_id\":5}}', NULL, NULL, NULL, '2026-07-04 16:45:06', '2026-07-04 16:45:06'),
(66, 'applications', 'updated', 'App\\Models\\Application', 1, 'updated', 'App\\Models\\User', 1, '{\"attributes\":{\"status\":\"converted\"},\"old\":{\"status\":\"new\"}}', NULL, NULL, NULL, '2026-07-04 16:45:06', '2026-07-04 16:45:06'),
(67, 'applications', 'created', 'App\\Models\\Application', 2, 'created', 'App\\Models\\User', 1, '{\"attributes\":{\"status\":\"new\",\"assigned_dealer_id\":null}}', NULL, NULL, NULL, '2026-07-04 16:51:17', '2026-07-04 16:51:17'),
(68, 'applications', 'created', 'App\\Models\\Application', 3, 'created', NULL, NULL, '{\"attributes\":{\"status\":\"new\",\"assigned_dealer_id\":null}}', NULL, NULL, NULL, '2026-07-04 16:53:48', '2026-07-04 16:53:48');

-- --------------------------------------------------------

--
-- Tablo için tablo yapısı `applications`
--

CREATE TABLE `applications` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `customer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `phone` varchar(20) NOT NULL,
  `email` varchar(255) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `il` varchar(100) NOT NULL,
  `ilce` varchar(100) NOT NULL,
  `package_id` bigint(20) UNSIGNED NOT NULL,
  `status` enum('new','assigned','contacted','converted','rejected') NOT NULL DEFAULT 'new' COMMENT 'new=Yeni, assigned=Atandi, contacted=Iletisime Gecildi, converted=Aboneliğe Donustu, rejected=Reddedildi',
  `assigned_dealer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `subscription_id` bigint(20) UNSIGNED DEFAULT NULL,
  `source` varchar(255) NOT NULL DEFAULT 'website' COMMENT 'website, admin, api',
  `ip_address` varchar(45) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Tablo döküm verisi `applications`
--

INSERT INTO `applications` (`id`, `customer_id`, `name`, `phone`, `email`, `address`, `il`, `ilce`, `package_id`, `status`, `assigned_dealer_id`, `subscription_id`, `source`, `ip_address`, `notes`, `created_at`, `updated_at`) VALUES
(1, NULL, 'dneme', '555', 'deneme@deneme.com', 'denem sokak', 'ist', 'bayrampaşa', 5, 'converted', 3, 3, 'website', '127.0.0.1', NULL, '2026-07-04 16:30:25', '2026-07-04 16:45:06'),
(2, 1, 'sadas', '2125442211', 'deneme@deneme.com', 'home\r\nbayrampasa', 'İstanbul', 'bayrampasa', 5, 'new', NULL, NULL, 'website', '127.0.0.1', NULL, '2026-07-04 16:51:17', '2026-07-04 16:51:17'),
(3, 1, 'ayet', '2125552211', 'a-azrak@hotmail.com', 'home\r\nbayrampasa', 'İstanbul', 'bayrampasa', 5, 'new', NULL, NULL, 'website', '127.0.0.1', NULL, '2026-07-04 16:53:48', '2026-07-04 16:53:48');

-- --------------------------------------------------------

--
-- Tablo için tablo yapısı `categories`
--

CREATE TABLE `categories` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `parent_id` bigint(20) UNSIGNED DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `status` enum('active','passive') NOT NULL DEFAULT 'active',
  `sort_order` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Tablo döküm verisi `categories`
--

INSERT INTO `categories` (`id`, `parent_id`, `name`, `slug`, `description`, `status`, `sort_order`, `created_at`, `updated_at`) VALUES
(1, NULL, 'DENEME', 'deneme', 'DENEME KATEGORİ', 'active', 0, '2026-07-04 16:08:08', '2026-07-04 16:08:08');

-- --------------------------------------------------------

--
-- Tablo için tablo yapısı `companies`
--

CREATE TABLE `companies` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL COMMENT 'Orn: Turk Telekom, Vodafone, Turknet',
  `slug` varchar(255) NOT NULL,
  `logo` varchar(255) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `status` enum('active','passive') NOT NULL DEFAULT 'active',
  `sort_order` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Tablo döküm verisi `companies`
--

INSERT INTO `companies` (`id`, `name`, `slug`, `logo`, `description`, `status`, `sort_order`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'Türk Telekom', 'turk-telekom', NULL, NULL, 'active', 1, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(2, 'Vodafone', 'vodafone', NULL, NULL, 'active', 2, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(3, 'Turkcell', 'turkcell', NULL, NULL, 'active', 3, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(4, 'D-Smart', 'd-smart', NULL, NULL, 'active', 4, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(5, 'TürkNet', 'turknet', NULL, NULL, 'active', 5, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(6, 'Millenicom', 'millenicom', NULL, NULL, 'active', 6, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(7, 'KabloNet', 'kablonet', NULL, NULL, 'active', 7, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL);

-- --------------------------------------------------------

--
-- Tablo için tablo yapısı `dealers`
--

CREATE TABLE `dealers` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `code` varchar(255) NOT NULL COMMENT 'Bayi kodu, orn: BYX0001',
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `parent_dealer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `company_name` varchar(255) NOT NULL COMMENT 'Bayinin ticari unvani',
  `tax_no` varchar(20) DEFAULT NULL,
  `tax_office` varchar(255) DEFAULT NULL,
  `phone` varchar(20) NOT NULL,
  `email` varchar(255) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `il` varchar(100) DEFAULT NULL,
  `ilce` varchar(100) DEFAULT NULL,
  `type` enum('sales','content','sales_content') NOT NULL DEFAULT 'sales' COMMENT 'sales=Satis Bayisi, content=Icerik Bayisi, sales_content=Her ikisi',
  `status` enum('active','passive') NOT NULL DEFAULT 'active',
  `notes` text DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Tablo döküm verisi `dealers`
--

INSERT INTO `dealers` (`id`, `code`, `user_id`, `parent_dealer_id`, `company_name`, `tax_no`, `tax_office`, `phone`, `email`, `address`, `il`, `ilce`, `type`, `status`, `notes`, `created_by`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'BYX0001', 2, NULL, 'Yılmaz Telekom Bayii', NULL, NULL, '05001112233', 'satisbayi@kolayabonelik.com', NULL, 'İstanbul', 'Kadıköy', 'sales', 'active', NULL, 1, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(2, 'BYX0002', 3, NULL, 'Demir Medya', NULL, NULL, '05004445566', 'icerikbayi@kolayabonelik.com', NULL, 'Ankara', 'Çankaya', 'content', 'active', NULL, 1, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(3, 'MASTER-ADMIN', 1, NULL, 'Master Admin', NULL, NULL, '0000000000', 'admin@kolayabonelik.com', NULL, NULL, NULL, 'sales', 'active', 'Bayiden gelmeyen bireysel başvuruların doğrudan merkezden yönetilmesi için kullanılır.', 1, '2026-07-04 16:44:42', '2026-07-04 16:44:42', NULL);

-- --------------------------------------------------------

--
-- Tablo için tablo yapısı `dealer_commissions`
--

CREATE TABLE `dealer_commissions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `dealer_id` bigint(20) UNSIGNED NOT NULL,
  `type` enum('percentage','fixed','hybrid') NOT NULL DEFAULT 'percentage' COMMENT 'percentage=Yuzdelik, fixed=Sabit, hybrid=Karma (yuzde + sabit)',
  `percentage` decimal(5,2) DEFAULT NULL COMMENT 'Ornek: 10.00 = %10',
  `fixed_amount` decimal(12,2) DEFAULT NULL COMMENT 'Sabit tutar veya karma sabit ek',
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `effective_date` date NOT NULL COMMENT 'Yururluk baslangic tarihi',
  `end_date` date DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Tablo döküm verisi `dealer_commissions`
--

INSERT INTO `dealer_commissions` (`id`, `dealer_id`, `type`, `percentage`, `fixed_amount`, `is_active`, `effective_date`, `end_date`, `notes`, `created_by`, `created_at`, `updated_at`) VALUES
(1, 1, 'hybrid', 10.00, 100.00, 0, '2026-07-01', '2026-07-04', NULL, 1, '2026-07-04 15:04:27', '2026-07-04 15:41:50'),
(2, 1, 'percentage', 10.00, NULL, 0, '2026-07-04', '2026-07-04', NULL, 1, '2026-07-04 15:41:50', '2026-07-04 15:42:09'),
(3, 1, 'percentage', 10.00, NULL, 1, '2026-07-04', NULL, NULL, 1, '2026-07-04 15:42:09', '2026-07-04 15:42:09');

-- --------------------------------------------------------

--
-- Tablo için tablo yapısı `earnings`
--

CREATE TABLE `earnings` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `dealer_id` bigint(20) UNSIGNED NOT NULL,
  `subscription_id` bigint(20) UNSIGNED NOT NULL,
  `dealer_commission_id` bigint(20) UNSIGNED DEFAULT NULL,
  `commission_type` enum('percentage','fixed','hybrid') NOT NULL,
  `package_price` decimal(12,2) NOT NULL COMMENT 'Hesaplama anindaki paket fiyati',
  `commission_percentage` decimal(5,2) DEFAULT NULL,
  `percentage_amount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `fixed_amount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total_amount` decimal(12,2) NOT NULL COMMENT 'percentage_amount + fixed_amount toplami / hakedis tutari',
  `status` enum('pending','partially_paid','paid') NOT NULL DEFAULT 'pending',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Tablo döküm verisi `earnings`
--

INSERT INTO `earnings` (`id`, `dealer_id`, `subscription_id`, `dealer_commission_id`, `commission_type`, `package_price`, `commission_percentage`, `percentage_amount`, `fixed_amount`, `total_amount`, `status`, `created_at`, `updated_at`) VALUES
(2, 1, 2, 3, 'percentage', 2388.00, 10.00, 238.80, 0.00, 238.80, 'pending', '2026-07-04 15:52:26', '2026-07-04 15:52:26');

-- --------------------------------------------------------

--
-- Tablo için tablo yapısı `failed_jobs`
--

CREATE TABLE `failed_jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `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()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Tablo için tablo yapısı `jobs`
--

CREATE TABLE `jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `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
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Tablo için tablo yapısı `job_batches`
--

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
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Tablo için tablo yapısı `migrations`
--

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

--
-- Tablo döküm verisi `migrations`
--

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2025_01_01_000001_create_users_table', 1),
(2, '2025_01_01_000002_create_cache_table', 1),
(3, '2025_01_01_000003_create_jobs_table', 1),
(4, '2025_01_01_000004_create_permission_tables', 1),
(5, '2025_01_01_000005_create_activity_logs_table', 1),
(6, '2025_01_01_000006_create_notifications_table', 1),
(7, '2025_01_01_000007_create_settings_table', 1),
(8, '2025_01_01_000010_create_dealers_table', 1),
(9, '2025_01_01_000011_add_dealer_id_to_users_table', 1),
(10, '2025_01_01_000012_create_dealer_commissions_table', 1),
(11, '2025_01_01_000013_create_companies_table', 1),
(12, '2025_01_01_000014_create_packages_table', 1),
(13, '2025_01_01_000015_create_subscriptions_table', 1),
(14, '2025_01_01_000016_create_earnings_table', 1),
(15, '2025_01_01_000017_create_payments_table', 1),
(16, '2025_01_01_000018_create_categories_table', 1),
(17, '2025_01_01_000019_create_posts_table', 1),
(18, '2025_01_01_000020_create_applications_table', 1),
(19, '2025_01_02_000001_add_contract_months_to_subscriptions_table', 2),
(20, '2025_01_03_000001_create_subscription_reminders_table', 3),
(21, '2025_01_03_000002_create_customers_table', 4),
(22, '2025_01_03_000003_add_customer_id_to_applications_table', 4);

-- --------------------------------------------------------

--
-- Tablo için tablo yapısı `model_has_permissions`
--

CREATE TABLE `model_has_permissions` (
  `permission_id` bigint(20) UNSIGNED NOT NULL,
  `model_type` varchar(255) NOT NULL,
  `model_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Tablo için tablo yapısı `model_has_roles`
--

CREATE TABLE `model_has_roles` (
  `role_id` bigint(20) UNSIGNED NOT NULL,
  `model_type` varchar(255) NOT NULL,
  `model_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Tablo döküm verisi `model_has_roles`
--

INSERT INTO `model_has_roles` (`role_id`, `model_type`, `model_id`) VALUES
(1, 'App\\Models\\User', 1),
(2, 'App\\Models\\User', 2),
(3, 'App\\Models\\User', 3);

-- --------------------------------------------------------

--
-- Tablo için tablo yapısı `notifications`
--

CREATE TABLE `notifications` (
  `id` char(36) NOT NULL,
  `type` varchar(255) NOT NULL,
  `notifiable_type` varchar(255) NOT NULL,
  `notifiable_id` bigint(20) UNSIGNED NOT NULL,
  `category` varchar(255) DEFAULT NULL COMMENT 'sistem | eposta | finans | basvuru',
  `data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`data`)),
  `read_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Tablo döküm verisi `notifications`
--

INSERT INTO `notifications` (`id`, `type`, `notifiable_type`, `notifiable_id`, `category`, `data`, `read_at`, `created_at`, `updated_at`) VALUES
('18864a47-1e5a-4394-8264-c9e07a715640', 'App\\Notifications\\SubscriptionStatusChangedNotification', 'App\\Models\\User', 2, NULL, '{\"category\":\"sistem\",\"subscription_id\":2,\"title\":\"Abonelik Durumu De\\u011fi\\u015fti\",\"message\":\"SUB-2026-000002 \\u2192 Tamamland\\u0131\"}', NULL, '2026-07-04 15:52:26', '2026-07-04 15:52:26'),
('268f14d0-177e-405f-91d2-27d2eb5489b5', 'App\\Notifications\\CommissionEarnedNotification', 'App\\Models\\User', 2, NULL, '{\"category\":\"finans\",\"earning_id\":2,\"title\":\"Hakedi\\u015f Hesapland\\u0131\",\"message\":\"238.80 TL hakedi\\u015f hesab\\u0131n\\u0131za eklendi.\"}', NULL, '2026-07-04 15:52:26', '2026-07-04 15:52:26'),
('44234b38-b1f2-4322-803b-b2d818f75963', 'App\\Notifications\\NewApplicationNotification', 'App\\Models\\User', 1, NULL, '{\"category\":\"basvuru\",\"application_id\":1,\"title\":\"Yeni Ba\\u015fvuru\",\"message\":\"dneme online ba\\u015fvuru formunu doldurdu.\"}', NULL, '2026-07-04 16:30:25', '2026-07-04 16:30:25'),
('787ce6a8-2a5c-43fc-840d-ad4a2ea40de4', 'App\\Notifications\\NewApplicationNotification', 'App\\Models\\User', 1, NULL, '{\"category\":\"basvuru\",\"application_id\":2,\"title\":\"Yeni Ba\\u015fvuru\",\"message\":\"sadas online ba\\u015fvuru formunu doldurdu.\"}', NULL, '2026-07-04 16:51:17', '2026-07-04 16:51:17'),
('7ffd6d76-8c7e-4fa0-aef2-11f54e473585', 'App\\Notifications\\NewApplicationNotification', 'App\\Models\\User', 1, NULL, '{\"category\":\"basvuru\",\"application_id\":3,\"title\":\"Yeni Ba\\u015fvuru\",\"message\":\"ayet online ba\\u015fvuru formunu doldurdu.\"}', NULL, '2026-07-04 16:53:48', '2026-07-04 16:53:48'),
('ffe30be1-decd-459c-9583-c4ac05b71066', 'App\\Notifications\\PaymentRecordedNotification', 'App\\Models\\User', 2, NULL, '{\"category\":\"finans\",\"payment_id\":1,\"title\":\"\\u00d6deme Giri\\u015fi\",\"message\":\"238.00 TL \\u00f6deme hesab\\u0131n\\u0131za i\\u015flendi.\"}', NULL, '2026-07-04 15:57:55', '2026-07-04 15:57:55');

-- --------------------------------------------------------

--
-- Tablo için tablo yapısı `packages`
--

CREATE TABLE `packages` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `service_type` enum('internet','tv','internet_tv','fiber','dsl','mobile_internet') NOT NULL COMMENT 'internet, tv, internet_tv, fiber, dsl, mobile_internet',
  `speed` varchar(50) DEFAULT NULL COMMENT 'Orn: 100 Mbps',
  `quota` varchar(50) DEFAULT NULL COMMENT 'Orn: Sinirsiz / 100 GB',
  `tv_content` text DEFAULT NULL,
  `setup_fee` decimal(12,2) NOT NULL DEFAULT 0.00,
  `monthly_fee` decimal(12,2) NOT NULL COMMENT 'Aylik ucret / Paket fiyati - komisyon bu tutar uzerinden hesaplanir',
  `campaign` varchar(255) DEFAULT NULL,
  `image` varchar(255) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `status` enum('active','passive') NOT NULL DEFAULT 'active',
  `sort_order` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Tablo döküm verisi `packages`
--

INSERT INTO `packages` (`id`, `company_id`, `name`, `slug`, `service_type`, `speed`, `quota`, `tv_content`, `setup_fee`, `monthly_fee`, `campaign`, `image`, `description`, `status`, `sort_order`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 'Türk Telekom 50 Mbps Paketi', 'turk-telekom-50-mbps-paketi-6a494b2b57b03', 'internet', '50 Mbps', 'Sınırsız', '120+ Kanal', 0.00, 199.00, 'İlk 3 Ay %20 İndirim', NULL, 'Türk Telekom 50 Mbps hızında internet paketi.', 'active', 1, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(2, 1, 'Türk Telekom 100 Mbps Paketi', 'turk-telekom-100-mbps-paketi-6a494b2b58ab1', 'internet_tv', '100 Mbps', 'Sınırsız', NULL, 0.00, 299.00, NULL, NULL, 'Türk Telekom 100 Mbps hızında internet paketi.', 'active', 2, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(3, 1, 'Türk Telekom 250 Mbps Paketi', 'turk-telekom-250-mbps-paketi-6a494b2b5961d', 'fiber', '250 Mbps', 'Sınırsız', '120+ Kanal', 0.00, 399.00, NULL, NULL, 'Türk Telekom 250 Mbps hızında internet paketi.', 'active', 3, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(4, 1, 'Türk Telekom 500 Mbps Paketi', 'turk-telekom-500-mbps-paketi-6a494b2b59f8a', 'tv', '500 Mbps', 'Sınırsız', NULL, 0.00, 499.00, NULL, NULL, 'Türk Telekom 500 Mbps hızında internet paketi.', 'active', 4, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(5, 2, 'Vodafone 50 Mbps Paketi', 'vodafone-50-mbps-paketi-6a494b2b5aa3e', 'internet', '50 Mbps', 'Sınırsız', '120+ Kanal', 0.00, 199.00, 'İlk 3 Ay %20 İndirim', NULL, 'Vodafone 50 Mbps hızında internet paketi.', 'active', 1, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(6, 2, 'Vodafone 100 Mbps Paketi', 'vodafone-100-mbps-paketi-6a494b2b5b4b9', 'internet_tv', '100 Mbps', 'Sınırsız', NULL, 0.00, 299.00, NULL, NULL, 'Vodafone 100 Mbps hızında internet paketi.', 'active', 2, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(7, 2, 'Vodafone 250 Mbps Paketi', 'vodafone-250-mbps-paketi-6a494b2b5be45', 'fiber', '250 Mbps', 'Sınırsız', '120+ Kanal', 0.00, 399.00, NULL, NULL, 'Vodafone 250 Mbps hızında internet paketi.', 'active', 3, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(8, 2, 'Vodafone 500 Mbps Paketi', 'vodafone-500-mbps-paketi-6a494b2b5c7e4', 'tv', '500 Mbps', 'Sınırsız', NULL, 0.00, 499.00, NULL, NULL, 'Vodafone 500 Mbps hızında internet paketi.', 'active', 4, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(9, 3, 'Turkcell 50 Mbps Paketi', 'turkcell-50-mbps-paketi-6a494b2b5d161', 'internet', '50 Mbps', 'Sınırsız', '120+ Kanal', 0.00, 199.00, 'İlk 3 Ay %20 İndirim', NULL, 'Turkcell 50 Mbps hızında internet paketi.', 'active', 1, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(10, 3, 'Turkcell 100 Mbps Paketi', 'turkcell-100-mbps-paketi-6a494b2b5dcbb', 'internet_tv', '100 Mbps', 'Sınırsız', NULL, 0.00, 299.00, NULL, NULL, 'Turkcell 100 Mbps hızında internet paketi.', 'active', 2, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(11, 3, 'Turkcell 250 Mbps Paketi', 'turkcell-250-mbps-paketi-6a494b2b5e647', 'fiber', '250 Mbps', 'Sınırsız', '120+ Kanal', 0.00, 399.00, NULL, NULL, 'Turkcell 250 Mbps hızında internet paketi.', 'active', 3, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(12, 3, 'Turkcell 500 Mbps Paketi', 'turkcell-500-mbps-paketi-6a494b2b5f0ac', 'tv', '500 Mbps', 'Sınırsız', NULL, 0.00, 499.00, NULL, NULL, 'Turkcell 500 Mbps hızında internet paketi.', 'active', 4, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(13, 4, 'D-Smart 50 Mbps Paketi', 'd-smart-50-mbps-paketi-6a494b2b5fa91', 'internet', '50 Mbps', 'Sınırsız', '120+ Kanal', 0.00, 199.00, 'İlk 3 Ay %20 İndirim', NULL, 'D-Smart 50 Mbps hızında internet paketi.', 'active', 1, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(14, 4, 'D-Smart 100 Mbps Paketi', 'd-smart-100-mbps-paketi-6a494b2b60459', 'internet_tv', '100 Mbps', 'Sınırsız', NULL, 0.00, 299.00, NULL, NULL, 'D-Smart 100 Mbps hızında internet paketi.', 'active', 2, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(15, 4, 'D-Smart 250 Mbps Paketi', 'd-smart-250-mbps-paketi-6a494b2b60df1', 'fiber', '250 Mbps', 'Sınırsız', '120+ Kanal', 0.00, 399.00, NULL, NULL, 'D-Smart 250 Mbps hızında internet paketi.', 'active', 3, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(16, 4, 'D-Smart 500 Mbps Paketi', 'd-smart-500-mbps-paketi-6a494b2b6188c', 'tv', '500 Mbps', 'Sınırsız', NULL, 0.00, 499.00, NULL, NULL, 'D-Smart 500 Mbps hızında internet paketi.', 'active', 4, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(17, 5, 'TürkNet 50 Mbps Paketi', 'turknet-50-mbps-paketi-6a494b2b622c2', 'internet', '50 Mbps', 'Sınırsız', '120+ Kanal', 0.00, 199.00, 'İlk 3 Ay %20 İndirim', NULL, 'TürkNet 50 Mbps hızında internet paketi.', 'active', 1, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(18, 5, 'TürkNet 100 Mbps Paketi', 'turknet-100-mbps-paketi-6a494b2b62ca5', 'internet_tv', '100 Mbps', 'Sınırsız', NULL, 0.00, 299.00, NULL, NULL, 'TürkNet 100 Mbps hızında internet paketi.', 'active', 2, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(19, 5, 'TürkNet 250 Mbps Paketi', 'turknet-250-mbps-paketi-6a494b2b6369e', 'fiber', '250 Mbps', 'Sınırsız', '120+ Kanal', 0.00, 399.00, NULL, NULL, 'TürkNet 250 Mbps hızında internet paketi.', 'active', 3, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(20, 5, 'TürkNet 500 Mbps Paketi', 'turknet-500-mbps-paketi-6a494b2b64055', 'tv', '500 Mbps', 'Sınırsız', NULL, 0.00, 499.00, NULL, NULL, 'TürkNet 500 Mbps hızında internet paketi.', 'active', 4, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(21, 6, 'Millenicom 50 Mbps Paketi', 'millenicom-50-mbps-paketi-6a494b2b64a14', 'internet', '50 Mbps', 'Sınırsız', '120+ Kanal', 0.00, 199.00, 'İlk 3 Ay %20 İndirim', NULL, 'Millenicom 50 Mbps hızında internet paketi.', 'active', 1, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(22, 6, 'Millenicom 100 Mbps Paketi', 'millenicom-100-mbps-paketi-6a494b2b65396', 'internet_tv', '100 Mbps', 'Sınırsız', NULL, 0.00, 299.00, NULL, NULL, 'Millenicom 100 Mbps hızında internet paketi.', 'active', 2, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(23, 6, 'Millenicom 250 Mbps Paketi', 'millenicom-250-mbps-paketi-6a494b2b65d21', 'fiber', '250 Mbps', 'Sınırsız', '120+ Kanal', 0.00, 399.00, NULL, NULL, 'Millenicom 250 Mbps hızında internet paketi.', 'active', 3, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(24, 6, 'Millenicom 500 Mbps Paketi', 'millenicom-500-mbps-paketi-6a494b2b6669a', 'tv', '500 Mbps', 'Sınırsız', NULL, 0.00, 499.00, NULL, NULL, 'Millenicom 500 Mbps hızında internet paketi.', 'active', 4, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(25, 7, 'KabloNet 50 Mbps Paketi', 'kablonet-50-mbps-paketi-6a494b2b67078', 'internet', '50 Mbps', 'Sınırsız', '120+ Kanal', 0.00, 199.00, 'İlk 3 Ay %20 İndirim', NULL, 'KabloNet 50 Mbps hızında internet paketi.', 'active', 1, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(26, 7, 'KabloNet 100 Mbps Paketi', 'kablonet-100-mbps-paketi-6a494b2b679dc', 'internet_tv', '100 Mbps', 'Sınırsız', NULL, 0.00, 299.00, NULL, NULL, 'KabloNet 100 Mbps hızında internet paketi.', 'active', 2, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(27, 7, 'KabloNet 250 Mbps Paketi', 'kablonet-250-mbps-paketi-6a494b2b68343', 'fiber', '250 Mbps', 'Sınırsız', '120+ Kanal', 0.00, 399.00, NULL, NULL, 'KabloNet 250 Mbps hızında internet paketi.', 'active', 3, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL),
(28, 7, 'KabloNet 500 Mbps Paketi', 'kablonet-500-mbps-paketi-6a494b2b68cd6', 'tv', '500 Mbps', 'Sınırsız', NULL, 0.00, 499.00, NULL, NULL, 'KabloNet 500 Mbps hızında internet paketi.', 'active', 4, '2026-07-04 15:04:27', '2026-07-04 15:04:27', NULL);

-- --------------------------------------------------------

--
-- Tablo için tablo yapısı `payments`
--

CREATE TABLE `payments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `dealer_id` bigint(20) UNSIGNED NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `payment_date` date NOT NULL,
  `description` text DEFAULT NULL,
  `payment_type` enum('havale','eft','nakit','diger') NOT NULL DEFAULT 'havale',
  `receipt_file` varchar(255) DEFAULT NULL COMMENT 'Dekont/belge dosya yolu',
  `created_by` bigint(20) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Tablo döküm verisi `payments`
--

INSERT INTO `payments` (`id`, `dealer_id`, `amount`, `payment_date`, `description`, `payment_type`, `receipt_file`, `created_by`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 238.00, '2026-07-04', 'havale', 'havale', 'payments/receipts/0vQ94P7jCYDBxCW60mBGgPfkkyMaGGgFhVYSVUsU.png', 1, '2026-07-04 15:57:55', '2026-07-04 15:57:55', NULL);

-- --------------------------------------------------------

--
-- Tablo için tablo yapısı `permissions`
--

CREATE TABLE `permissions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `guard_name` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Tablo döküm verisi `permissions`
--

INSERT INTO `permissions` (`id`, `name`, `guard_name`, `created_at`, `updated_at`) VALUES
(1, 'dealers.view', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(2, 'dealers.create', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(3, 'dealers.update', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(4, 'dealers.delete', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(5, 'dealers.manage-commission', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(6, 'companies.view', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(7, 'companies.create', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(8, 'companies.update', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(9, 'companies.delete', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(10, 'packages.view', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(11, 'packages.create', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(12, 'packages.update', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(13, 'packages.delete', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(14, 'subscriptions.view', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(15, 'subscriptions.view-all', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(16, 'subscriptions.create', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(17, 'subscriptions.update', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(18, 'subscriptions.update-all', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(19, 'subscriptions.change-status', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(20, 'subscriptions.delete', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(21, 'finance.view', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(22, 'finance.view-all', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(23, 'finance.create-payment', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(24, 'reports.view', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(25, 'reports.export', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(26, 'content.categories.view', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(27, 'content.categories.create', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(28, 'content.categories.update', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(29, 'content.categories.delete', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(30, 'content.posts.view', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(31, 'content.posts.create', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(32, 'content.posts.update', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(33, 'content.posts.update-all', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(34, 'content.posts.delete', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(35, 'applications.view', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(36, 'applications.assign', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(37, 'applications.convert', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(38, 'users.view', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(39, 'users.create', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(40, 'users.update', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(41, 'users.delete', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(42, 'roles.view', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(43, 'roles.manage', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(44, 'settings.manage', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(45, 'dashboard.view', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(46, 'customers.view', 'web', '2026-07-04 17:00:25', '2026-07-04 17:00:25'),
(47, 'customers.delete', 'web', '2026-07-04 17:00:25', '2026-07-04 17:00:25');

-- --------------------------------------------------------

--
-- Tablo için tablo yapısı `posts`
--

CREATE TABLE `posts` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `category_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `title` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `excerpt` varchar(500) DEFAULT NULL,
  `content` longtext DEFAULT NULL COMMENT 'SSS icin soru=title, cevap=content olarak kullanilir',
  `type` enum('blog','campaign','announcement','faq','page') NOT NULL COMMENT 'blog=Blog Yazisi, campaign=Kampanya, announcement=Duyuru, faq=SSS, page=Sayfa',
  `image` varchar(255) DEFAULT NULL,
  `meta` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'SEO title/description vb.' CHECK (json_valid(`meta`)),
  `status` enum('draft','published') NOT NULL DEFAULT 'draft',
  `published_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Tablo için tablo yapısı `roles`
--

CREATE TABLE `roles` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `guard_name` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Tablo döküm verisi `roles`
--

INSERT INTO `roles` (`id`, `name`, `guard_name`, `created_at`, `updated_at`) VALUES
(1, 'master-admin', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(2, 'dealer-sales', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27'),
(3, 'dealer-content', 'web', '2026-07-04 15:04:27', '2026-07-04 15:04:27');

-- --------------------------------------------------------

--
-- Tablo için tablo yapısı `role_has_permissions`
--

CREATE TABLE `role_has_permissions` (
  `permission_id` bigint(20) UNSIGNED NOT NULL,
  `role_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Tablo döküm verisi `role_has_permissions`
--

INSERT INTO `role_has_permissions` (`permission_id`, `role_id`) VALUES
(1, 1),
(2, 1),
(3, 1),
(4, 1),
(5, 1),
(6, 1),
(6, 2),
(7, 1),
(8, 1),
(9, 1),
(10, 1),
(10, 2),
(11, 1),
(12, 1),
(13, 1),
(14, 1),
(14, 2),
(15, 1),
(16, 1),
(16, 2),
(17, 1),
(17, 2),
(18, 1),
(19, 1),
(20, 1),
(21, 1),
(21, 2),
(22, 1),
(23, 1),
(24, 1),
(25, 1),
(26, 1),
(26, 3),
(27, 1),
(27, 3),
(28, 1),
(28, 3),
(29, 1),
(30, 1),
(30, 3),
(31, 1),
(31, 3),
(32, 1),
(32, 3),
(33, 1),
(34, 1),
(35, 1),
(36, 1),
(37, 1),
(38, 1),
(39, 1),
(40, 1),
(41, 1),
(42, 1),
(43, 1),
(44, 1),
(45, 1),
(45, 2),
(45, 3),
(46, 1),
(47, 1);

-- --------------------------------------------------------

--
-- Tablo için tablo yapısı `sessions`
--

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
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Tablo için tablo yapısı `subscriptions`
--

CREATE TABLE `subscriptions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `reference_no` varchar(255) NOT NULL COMMENT 'Orn: SUB-2026-000001',
  `dealer_id` bigint(20) UNSIGNED NOT NULL,
  `company_id` bigint(20) UNSIGNED NOT NULL,
  `package_id` bigint(20) UNSIGNED NOT NULL,
  `customer_name` varchar(255) NOT NULL,
  `tc_no` varchar(11) DEFAULT NULL COMMENT 'TC Kimlik No',
  `id_document_path` varchar(255) DEFAULT NULL COMMENT 'Kimlik gorseli dosya yolu',
  `phone` varchar(20) NOT NULL,
  `email` varchar(255) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `il` varchar(100) NOT NULL,
  `ilce` varchar(100) NOT NULL,
  `service_type` enum('internet','tv','internet_tv','fiber','dsl','mobile_internet') NOT NULL,
  `contract_months` int(10) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Kac aylik sozlesme yapildi',
  `total_price` decimal(12,2) DEFAULT NULL COMMENT 'monthly_fee * contract_months anlik goruntusu',
  `notes` text DEFAULT NULL,
  `status` enum('draft','pending','reviewing','approved','completed','cancelled') NOT NULL DEFAULT 'draft' COMMENT 'draft=Taslak, pending=Beklemede, reviewing=Inceleniyor, approved=Onaylandi, completed=Tamamlandi, cancelled=Iptal',
  `cancel_reason` text DEFAULT NULL,
  `approved_at` timestamp NULL DEFAULT NULL,
  `completed_at` timestamp NULL DEFAULT NULL,
  `cancelled_at` timestamp NULL DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED NOT NULL,
  `updated_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Tablo döküm verisi `subscriptions`
--

INSERT INTO `subscriptions` (`id`, `reference_no`, `dealer_id`, `company_id`, `package_id`, `customer_name`, `tc_no`, `id_document_path`, `phone`, `email`, `address`, `il`, `ilce`, `service_type`, `contract_months`, `total_price`, `notes`, `status`, `cancel_reason`, `approved_at`, `completed_at`, `cancelled_at`, `created_by`, `updated_by`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'SUB-2026-000001', 1, 1, 1, 'asdasdas', '12345678911', 'subscriptions/id-documents/NNfuvIZNOKaUItmADqW53DyxxUpHhLrizIkpQSgA.png', '2122542133', 'deneme@deneme.com', 'vatan', 'İstanbul', 'bayrampasa', 'internet', 1, NULL, 'dnemendemde', 'completed', NULL, NULL, '2026-07-04 15:30:25', NULL, 2, 1, '2026-07-04 15:30:05', '2026-07-04 15:30:25', NULL),
(2, 'SUB-2026-000002', 1, 1, 1, 'sdfsd', '12345678911', 'subscriptions/id-documents/TvuhUbfDk2DaMbYtCjiw0KfgsiLvKGsFUutwGl8m.png', '2125552211', 'deneme@deneme.com', 'sadasdasd', 'istan', 'bay', 'internet', 12, 2388.00, 'asd', 'completed', NULL, NULL, '2026-07-04 15:52:26', NULL, 2, 1, '2026-07-04 15:51:33', '2026-07-04 15:52:26', NULL),
(3, 'SUB-2026-000003', 3, 2, 5, 'dneme', NULL, NULL, '555', 'deneme@deneme.com', 'denem sokak', 'ist', 'bayrampaşa', 'internet', 1, 199.00, NULL, 'pending', NULL, NULL, NULL, NULL, 1, NULL, '2026-07-04 16:45:06', '2026-07-04 16:45:06', NULL);

-- --------------------------------------------------------

--
-- Tablo için tablo yapısı `subscription_reminders`
--

CREATE TABLE `subscription_reminders` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `subscription_id` bigint(20) UNSIGNED NOT NULL,
  `days_before` int(10) UNSIGNED NOT NULL,
  `channel` enum('email','sms') NOT NULL,
  `sent_at` timestamp NULL DEFAULT NULL,
  `success` tinyint(1) NOT NULL DEFAULT 1,
  `error_message` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dökümü yapılmış tablolar için indeksler
--

--
-- Tablo için indeksler `activity_logs`
--
ALTER TABLE `activity_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `subject` (`subject_type`,`subject_id`),
  ADD KEY `causer` (`causer_type`,`causer_id`),
  ADD KEY `activity_logs_log_name_index` (`log_name`);

--
-- Tablo için indeksler `applications`
--
ALTER TABLE `applications`
  ADD PRIMARY KEY (`id`),
  ADD KEY `applications_package_id_foreign` (`package_id`),
  ADD KEY `applications_assigned_dealer_id_foreign` (`assigned_dealer_id`),
  ADD KEY `applications_subscription_id_foreign` (`subscription_id`),
  ADD KEY `applications_status_index` (`status`),
  ADD KEY `applications_il_ilce_index` (`il`,`ilce`),
  ADD KEY `applications_customer_id_foreign` (`customer_id`);

--
-- Tablo için indeksler `categories`
--
ALTER TABLE `categories`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `categories_slug_unique` (`slug`),
  ADD KEY `categories_parent_id_foreign` (`parent_id`),
  ADD KEY `categories_status_sort_order_index` (`status`,`sort_order`);

--
-- Tablo için indeksler `companies`
--
ALTER TABLE `companies`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `companies_name_unique` (`name`),
  ADD UNIQUE KEY `companies_slug_unique` (`slug`),
  ADD KEY `companies_status_sort_order_index` (`status`,`sort_order`);

--
-- Tablo için indeksler `dealers`
--
ALTER TABLE `dealers`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `dealers_code_unique` (`code`),
  ADD UNIQUE KEY `dealers_user_id_unique` (`user_id`),
  ADD KEY `dealers_parent_dealer_id_foreign` (`parent_dealer_id`),
  ADD KEY `dealers_created_by_foreign` (`created_by`),
  ADD KEY `dealers_status_type_index` (`status`,`type`),
  ADD KEY `dealers_il_ilce_index` (`il`,`ilce`);

--
-- Tablo için indeksler `dealer_commissions`
--
ALTER TABLE `dealer_commissions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `dealer_commissions_created_by_foreign` (`created_by`),
  ADD KEY `dealer_commissions_dealer_id_is_active_index` (`dealer_id`,`is_active`);

--
-- Tablo için indeksler `earnings`
--
ALTER TABLE `earnings`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `earnings_subscription_id_unique` (`subscription_id`),
  ADD KEY `earnings_dealer_commission_id_foreign` (`dealer_commission_id`),
  ADD KEY `earnings_dealer_id_status_index` (`dealer_id`,`status`);

--
-- Tablo için indeksler `failed_jobs`
--
ALTER TABLE `failed_jobs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);

--
-- Tablo için indeksler `jobs`
--
ALTER TABLE `jobs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `jobs_queue_index` (`queue`);

--
-- Tablo için indeksler `job_batches`
--
ALTER TABLE `job_batches`
  ADD PRIMARY KEY (`id`);

--
-- Tablo için indeksler `migrations`
--
ALTER TABLE `migrations`
  ADD PRIMARY KEY (`id`);

--
-- Tablo için indeksler `model_has_permissions`
--
ALTER TABLE `model_has_permissions`
  ADD PRIMARY KEY (`permission_id`,`model_id`,`model_type`),
  ADD KEY `model_has_permissions_model_id_model_type_index` (`model_id`,`model_type`);

--
-- Tablo için indeksler `model_has_roles`
--
ALTER TABLE `model_has_roles`
  ADD PRIMARY KEY (`role_id`,`model_id`,`model_type`),
  ADD KEY `model_has_roles_model_id_model_type_index` (`model_id`,`model_type`);

--
-- Tablo için indeksler `notifications`
--
ALTER TABLE `notifications`
  ADD PRIMARY KEY (`id`),
  ADD KEY `notifications_notifiable_type_notifiable_id_index` (`notifiable_type`,`notifiable_id`);

--
-- Tablo için indeksler `packages`
--
ALTER TABLE `packages`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `packages_slug_unique` (`slug`),
  ADD KEY `packages_status_service_type_index` (`status`,`service_type`),
  ADD KEY `packages_company_id_status_index` (`company_id`,`status`);

--
-- Tablo için indeksler `payments`
--
ALTER TABLE `payments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `payments_created_by_foreign` (`created_by`),
  ADD KEY `payments_dealer_id_payment_date_index` (`dealer_id`,`payment_date`);

--
-- Tablo için indeksler `permissions`
--
ALTER TABLE `permissions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `permissions_name_guard_name_unique` (`name`,`guard_name`);

--
-- Tablo için indeksler `posts`
--
ALTER TABLE `posts`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `posts_slug_unique` (`slug`),
  ADD KEY `posts_category_id_foreign` (`category_id`),
  ADD KEY `posts_user_id_foreign` (`user_id`),
  ADD KEY `posts_type_status_index` (`type`,`status`),
  ADD KEY `posts_published_at_index` (`published_at`);

--
-- Tablo için indeksler `roles`
--
ALTER TABLE `roles`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `roles_name_guard_name_unique` (`name`,`guard_name`);

--
-- Tablo için indeksler `role_has_permissions`
--
ALTER TABLE `role_has_permissions`
  ADD PRIMARY KEY (`permission_id`,`role_id`),
  ADD KEY `role_has_permissions_role_id_foreign` (`role_id`);

--
-- Tablo için indeksler `sessions`
--
ALTER TABLE `sessions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sessions_user_id_index` (`user_id`),
  ADD KEY `sessions_last_activity_index` (`last_activity`);

--
-- Tablo için indeksler `subscriptions`
--
ALTER TABLE `subscriptions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `subscriptions_reference_no_unique` (`reference_no`),
  ADD KEY `subscriptions_company_id_foreign` (`company_id`),
  ADD KEY `subscriptions_package_id_foreign` (`package_id`),
  ADD KEY `subscriptions_created_by_foreign` (`created_by`),
  ADD KEY `subscriptions_updated_by_foreign` (`updated_by`),
  ADD KEY `subscriptions_status_index` (`status`),
  ADD KEY `subscriptions_dealer_id_status_index` (`dealer_id`,`status`),
  ADD KEY `subscriptions_il_ilce_index` (`il`,`ilce`),
  ADD KEY `subscriptions_created_at_index` (`created_at`);

--
-- Tablo için indeksler `subscription_reminders`
--
ALTER TABLE `subscription_reminders`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `sub_reminder_unique` (`subscription_id`,`days_before`,`channel`);

--
-- Dökümü yapılmış tablolar için AUTO_INCREMENT değeri
--

--
-- Tablo için AUTO_INCREMENT değeri `activity_logs`
--
ALTER TABLE `activity_logs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=69;

--
-- Tablo için AUTO_INCREMENT değeri `applications`
--
ALTER TABLE `applications`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- Tablo için AUTO_INCREMENT değeri `categories`
--
ALTER TABLE `categories`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- Tablo için AUTO_INCREMENT değeri `companies`
--
ALTER TABLE `companies`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- Tablo için AUTO_INCREMENT değeri `dealers`
--
ALTER TABLE `dealers`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- Tablo için AUTO_INCREMENT değeri `dealer_commissions`
--
ALTER TABLE `dealer_commissions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- Tablo için AUTO_INCREMENT değeri `earnings`
--
ALTER TABLE `earnings`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- Tablo için AUTO_INCREMENT değeri `failed_jobs`
--
ALTER TABLE `failed_jobs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- Tablo için AUTO_INCREMENT değeri `jobs`
--
ALTER TABLE `jobs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- Tablo için AUTO_INCREMENT değeri `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;

--
-- Tablo için AUTO_INCREMENT değeri `packages`
--
ALTER TABLE `packages`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29;

--
-- Tablo için AUTO_INCREMENT değeri `payments`
--
ALTER TABLE `payments`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- Tablo için AUTO_INCREMENT değeri `permissions`
--
ALTER TABLE `permissions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=48;

--
-- Tablo için AUTO_INCREMENT değeri `posts`
--
ALTER TABLE `posts`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- Tablo için AUTO_INCREMENT değeri `roles`
--
ALTER TABLE `roles`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- Tablo için AUTO_INCREMENT değeri `subscriptions`
--
ALTER TABLE `subscriptions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- Tablo için AUTO_INCREMENT değeri `subscription_reminders`
--
ALTER TABLE `subscription_reminders`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- Dökümü yapılmış tablolar için kısıtlamalar
--

--
-- Tablo kısıtlamaları `applications`
--
ALTER TABLE `applications`
  ADD CONSTRAINT `applications_assigned_dealer_id_foreign` FOREIGN KEY (`assigned_dealer_id`) REFERENCES `dealers` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `applications_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `applications_package_id_foreign` FOREIGN KEY (`package_id`) REFERENCES `packages` (`id`),
  ADD CONSTRAINT `applications_subscription_id_foreign` FOREIGN KEY (`subscription_id`) REFERENCES `subscriptions` (`id`) ON DELETE SET NULL;

--
-- Tablo kısıtlamaları `categories`
--
ALTER TABLE `categories`
  ADD CONSTRAINT `categories_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `categories` (`id`) ON DELETE SET NULL;

--
-- Tablo kısıtlamaları `dealers`
--
ALTER TABLE `dealers`
  ADD CONSTRAINT `dealers_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `dealers_parent_dealer_id_foreign` FOREIGN KEY (`parent_dealer_id`) REFERENCES `dealers` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `dealers_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Tablo kısıtlamaları `dealer_commissions`
--
ALTER TABLE `dealer_commissions`
  ADD CONSTRAINT `dealer_commissions_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `dealer_commissions_dealer_id_foreign` FOREIGN KEY (`dealer_id`) REFERENCES `dealers` (`id`) ON DELETE CASCADE;

--
-- Tablo kısıtlamaları `earnings`
--
ALTER TABLE `earnings`
  ADD CONSTRAINT `earnings_dealer_commission_id_foreign` FOREIGN KEY (`dealer_commission_id`) REFERENCES `dealer_commissions` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `earnings_dealer_id_foreign` FOREIGN KEY (`dealer_id`) REFERENCES `dealers` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `earnings_subscription_id_foreign` FOREIGN KEY (`subscription_id`) REFERENCES `subscriptions` (`id`) ON DELETE CASCADE;

--
-- Tablo kısıtlamaları `model_has_permissions`
--
ALTER TABLE `model_has_permissions`
  ADD CONSTRAINT `model_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE;

--
-- Tablo kısıtlamaları `model_has_roles`
--
ALTER TABLE `model_has_roles`
  ADD CONSTRAINT `model_has_roles_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;

--
-- Tablo kısıtlamaları `packages`
--
ALTER TABLE `packages`
  ADD CONSTRAINT `packages_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE CASCADE;

--
-- Tablo kısıtlamaları `payments`
--
ALTER TABLE `payments`
  ADD CONSTRAINT `payments_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `payments_dealer_id_foreign` FOREIGN KEY (`dealer_id`) REFERENCES `dealers` (`id`) ON DELETE CASCADE;

--
-- Tablo kısıtlamaları `posts`
--
ALTER TABLE `posts`
  ADD CONSTRAINT `posts_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `posts_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Tablo kısıtlamaları `role_has_permissions`
--
ALTER TABLE `role_has_permissions`
  ADD CONSTRAINT `role_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `role_has_permissions_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;

--
-- Tablo kısıtlamaları `subscriptions`
--
ALTER TABLE `subscriptions`
  ADD CONSTRAINT `subscriptions_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`),
  ADD CONSTRAINT `subscriptions_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `subscriptions_dealer_id_foreign` FOREIGN KEY (`dealer_id`) REFERENCES `dealers` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `subscriptions_package_id_foreign` FOREIGN KEY (`package_id`) REFERENCES `packages` (`id`),
  ADD CONSTRAINT `subscriptions_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Tablo kısıtlamaları `subscription_reminders`
--
ALTER TABLE `subscription_reminders`
  ADD CONSTRAINT `subscription_reminders_subscription_id_foreign` FOREIGN KEY (`subscription_id`) REFERENCES `subscriptions` (`id`) ON DELETE CASCADE;
COMMIT;

