-- phpMyAdmin SQL Dump
-- version 5.2.2
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Apr 07, 2026 at 07:13 AM
-- Server version: 8.4.3
-- PHP Version: 8.2.28

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `db_skripsi_heri`
--

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

--
-- Table structure for table `businesses`
--

CREATE TABLE `businesses` (
  `id` bigint UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `business_type` enum('warung_makan','warung_kelontong') COLLATE utf8mb4_unicode_ci NOT NULL,
  `daily_transaction_estimate` smallint UNSIGNED NOT NULL DEFAULT '0',
  `signature_products` text COLLATE utf8mb4_unicode_ci,
  `address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `businesses`
--

INSERT INTO `businesses` (`id`, `name`, `business_type`, `daily_transaction_estimate`, `signature_products`, `address`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 'Warung Doyok', 'warung_makan', 100, 'Soto ayam, gulai daging sapi, aneka minuman, gorengan', 'Surabaya', 1, '2026-03-16 20:34:06', '2026-03-16 20:34:06'),
(2, 'Warung Cak Mun / Herawati', 'warung_makan', 100, 'Rawon balungan, pecel, krengsengan, bali, aneka minuman', 'Surabaya', 1, '2026-03-16 20:34:06', '2026-03-16 20:34:06'),
(3, 'Warung Pawon Asri', 'warung_makan', 50, 'Nasi campur, nasi sayur, mie ayam, es campur, es teler, es blewah', 'Surabaya', 1, '2026-03-16 20:34:06', '2026-03-16 20:34:06'),
(4, 'Warung Cak Wan', 'warung_kelontong', 50, 'Rokok dan aneka minuman', 'Surabaya', 1, '2026-03-16 20:34:06', '2026-03-16 20:34:06');

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

--
-- Table structure for table `cache`
--

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

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

--
-- Table structure for table `cache_locks`
--

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

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

--
-- Table structure for table `expenses`
--

CREATE TABLE `expenses` (
  `id` bigint UNSIGNED NOT NULL,
  `business_id` bigint UNSIGNED DEFAULT NULL,
  `user_id` bigint UNSIGNED NOT NULL,
  `type` enum('bahan baku','operasional','lainnya') COLLATE utf8mb4_unicode_ci NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `date` date NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `expenses`
--

INSERT INTO `expenses` (`id`, `business_id`, `user_id`, `type`, `amount`, `description`, `date`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 'bahan baku', 350000.00, 'Belanja bahan baku mingguan - Admin Warung Doyok', '2026-03-17', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(2, 1, 1, 'operasional', 150000.00, 'Biaya operasional harian - Admin Warung Doyok', '2026-03-17', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(3, 2, 3, 'bahan baku', 350000.00, 'Belanja bahan baku mingguan - Admin Cak Mun', '2026-03-17', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(4, 2, 3, 'operasional', 150000.00, 'Biaya operasional harian - Admin Cak Mun', '2026-03-17', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(5, 3, 4, 'bahan baku', 350000.00, 'Belanja bahan baku mingguan - Admin Pawon Asri', '2026-03-17', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(6, 3, 4, 'operasional', 150000.00, 'Biaya operasional harian - Admin Pawon Asri', '2026-03-17', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(7, 4, 5, 'bahan baku', 350000.00, 'Belanja bahan baku mingguan - Admin Cak Wan', '2026-03-17', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(8, 4, 5, 'operasional', 150000.00, 'Biaya operasional harian - Admin Cak Wan', '2026-03-17', '2026-03-16 20:34:09', '2026-03-16 20:34:09');

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

--
-- Table structure for table `ingredients`
--

CREATE TABLE `ingredients` (
  `id` bigint UNSIGNED NOT NULL,
  `business_id` bigint UNSIGNED DEFAULT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `unit` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `stock` decimal(12,2) NOT NULL DEFAULT '0.00',
  `min_stock` decimal(12,2) NOT NULL DEFAULT '0.00',
  `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `ingredients`
--

INSERT INTO `ingredients` (`id`, `business_id`, `name`, `unit`, `stock`, `min_stock`, `description`, `created_at`, `updated_at`) VALUES
(1, 2, 'Beras', 'kg', 50.00, 10.00, 'Bahan pokok nasi', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(2, 2, 'Ayam', 'kg', 30.00, 8.00, 'Bahan utama menu ayam', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(3, 2, 'Minyak Goreng', 'liter', 20.00, 5.00, 'Bahan untuk menggoreng', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(4, 2, 'Gula', 'kg', 10.00, 3.00, 'Pemanis minuman', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(5, 4, 'Stok Rokok Filter A', 'bungkus', 120.00, 20.00, 'Persediaan rokok filter A', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(6, 4, 'Stok Rokok Kretek B', 'bungkus', 100.00, 20.00, 'Persediaan rokok kretek B', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(7, 4, 'Stok Air Mineral', 'botol', 200.00, 50.00, 'Persediaan air mineral', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(8, 1, 'Beras', 'kg', 50.00, 10.00, 'Bahan pokok nasi', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(9, 1, 'Ayam', 'kg', 30.00, 8.00, 'Bahan utama menu ayam', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(10, 1, 'Minyak Goreng', 'liter', 20.00, 5.00, 'Bahan untuk menggoreng', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(11, 1, 'Gula', 'kg', 10.00, 3.00, 'Pemanis minuman', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(12, 3, 'Beras', 'kg', 50.00, 10.00, 'Bahan pokok nasi', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(13, 3, 'Ayam', 'kg', 30.00, 8.00, 'Bahan utama menu ayam', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(14, 3, 'Minyak Goreng', 'liter', 20.00, 5.00, 'Bahan untuk menggoreng', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(15, 3, 'Gula', 'kg', 10.00, 3.00, 'Pemanis minuman', '2026-03-16 20:34:09', '2026-03-16 20:34:09');

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

--
-- Table structure for table `menus`
--

CREATE TABLE `menus` (
  `id` bigint UNSIGNED NOT NULL,
  `business_id` bigint UNSIGNED DEFAULT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `price` decimal(12,2) NOT NULL,
  `menu_category_id` bigint UNSIGNED NOT NULL,
  `item_type` enum('makanan','minuman','gorengan','rokok','lainnya') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'lainnya',
  `sku` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_stock_tracked` tinyint(1) NOT NULL DEFAULT '1',
  `status` enum('tersedia','tidak') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'tersedia',
  `image` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `menus`
--

INSERT INTO `menus` (`id`, `business_id`, `name`, `price`, `menu_category_id`, `item_type`, `sku`, `is_stock_tracked`, `status`, `image`, `description`, `created_at`, `updated_at`) VALUES
(1, 1, 'Soto Ayam', 18000.00, 6, 'makanan', NULL, 1, 'tersedia', NULL, 'Soto ayam khas warung doyok', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(2, 1, 'Gulai Daging Sapi', 25000.00, 6, 'makanan', NULL, 1, 'tersedia', NULL, 'Gulai daging sapi', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(3, 1, 'Es Teh Manis', 6000.00, 7, 'minuman', NULL, 1, 'tersedia', NULL, 'Minuman segar', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(4, 1, 'Gorengan Campur', 5000.00, 8, 'gorengan', NULL, 1, 'tersedia', NULL, 'Aneka gorengan', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(5, 2, 'Rawon Balungan', 22000.00, 1, 'makanan', NULL, 1, 'tersedia', NULL, 'Rawon balungan khas', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(6, 2, 'Pecel', 15000.00, 1, 'makanan', NULL, 1, 'tersedia', NULL, 'Pecel sayur', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(7, 2, 'Krengsengan', 21000.00, 1, 'makanan', NULL, 1, 'tersedia', NULL, 'Krengsengan daging', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(8, 2, 'Es Jeruk', 7000.00, 2, 'minuman', NULL, 1, 'tersedia', NULL, 'Jeruk segar', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(9, 3, 'Nasi Campur', 17000.00, 9, 'makanan', NULL, 1, 'tersedia', NULL, 'Nasi campur komplit', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(10, 3, 'Mie Ayam', 15000.00, 9, 'makanan', NULL, 1, 'tersedia', NULL, 'Mie ayam porsi reguler', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(11, 3, 'Es Campur', 10000.00, 10, 'minuman', NULL, 1, 'tersedia', NULL, 'Es campur segar', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(12, 3, 'Es Teler', 12000.00, 10, 'minuman', NULL, 1, 'tersedia', NULL, 'Es teler spesial', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(13, 4, 'Rokok Filter A', 28000.00, 4, 'rokok', 'RKA-12', 1, 'tersedia', NULL, 'Rokok filter kemasan 12', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(14, 4, 'Rokok Kretek B', 23000.00, 4, 'rokok', 'RKB-12', 1, 'tersedia', NULL, 'Rokok kretek kemasan 12', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(15, 4, 'Air Mineral 600ml', 5000.00, 5, 'minuman', 'AM-600', 1, 'tersedia', NULL, 'Air mineral botol', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(16, 4, 'Teh Botol', 7000.00, 5, 'minuman', 'TB-450', 1, 'tersedia', NULL, 'Minuman teh kemasan botol', '2026-03-16 20:34:09', '2026-03-16 20:34:09');

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

--
-- Table structure for table `menu_categories`
--

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

--
-- Dumping data for table `menu_categories`
--

INSERT INTO `menu_categories` (`id`, `business_id`, `name`, `description`, `created_at`, `updated_at`) VALUES
(1, 2, 'Makanan Utama', 'Menu makanan berat harian', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(2, 2, 'Minuman', 'Minuman panas dan dingin', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(3, 2, 'Camilan', 'Makanan ringan', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(4, 4, 'Rokok', 'Berbagai merek rokok', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(5, 4, 'Minuman', 'Minuman kemasan dan sachet', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(6, 1, 'Makanan Utama', 'Menu makanan berat harian', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(7, 1, 'Minuman', 'Minuman panas dan dingin', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(8, 1, 'Camilan', 'Makanan ringan', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(9, 3, 'Makanan Utama', 'Menu makanan berat harian', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(10, 3, 'Minuman', 'Minuman panas dan dingin', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(11, 3, 'Camilan', 'Makanan ringan', '2026-03-16 20:34:09', '2026-03-16 20:34:09');

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

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

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

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

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '0001_01_01_000000_create_roles_table', 1),
(2, '0001_01_01_000000_create_users_table', 1),
(3, '2026_03_17_024950_create_menu_categories_table', 1),
(4, '2026_03_17_024951_create_menus_table', 1),
(5, '2026_03_17_024953_create_ingredients_table', 1),
(6, '2026_03_17_024954_create_stocks_table', 1),
(7, '2026_03_17_024955_create_transactions_table', 1),
(8, '2026_03_17_024956_create_expenses_table', 1),
(9, '2026_03_17_024957_create_transaction_items_table', 1),
(10, '2026_03_17_040100_create_businesses_table', 1),
(11, '2026_03_17_040101_add_business_scope_to_core_tables', 1),
(12, '2026_03_17_034638_create_cache_table', 2);

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

--
-- Table structure for table `password_reset_tokens`
--

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

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

--
-- Table structure for table `roles`
--

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

--
-- Dumping data for table `roles`
--

INSERT INTO `roles` (`id`, `name`, `code`, `description`, `permissions`, `created_at`, `updated_at`) VALUES
(1, 'Admin', 'admin', 'Akses penuh: kelola pengguna, menu, stok, transaksi, pengeluaran, dan laporan.', '[\"users.manage\", \"menus.manage\", \"stocks.manage\", \"transactions.manage\", \"expenses.manage\", \"reports.view\", \"dashboard.view\"]', '2026-03-16 20:34:06', '2026-03-16 20:34:06'),
(2, 'Kasir', 'kasir', 'Akses kasir: transaksi penjualan, lihat menu, dan cetak struk.', '[\"transactions.create\", \"transactions.view\", \"menus.view\", \"receipt.print\", \"dashboard.basic_view\"]', '2026-03-16 20:34:06', '2026-03-16 20:34:06');

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

--
-- Table structure for table `sessions`
--

CREATE TABLE `sessions` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` bigint UNSIGNED DEFAULT NULL,
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_agent` text COLLATE utf8mb4_unicode_ci,
  `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `last_activity` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sessions`
--

INSERT INTO `sessions` (`id`, `user_id`, `ip_address`, `user_agent`, `payload`, `last_activity`) VALUES
('qL9miyzKs4nn0goJQnUqjoXWKLrpMtaQQbdmSjsw', NULL, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiWUhhbE1EazVPQ1VnQTVZQWFlc3FTYmFqR052RldVdk5DTUFMT3VWbCI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MzE6Imh0dHBzOi8vc2tyaXBzaS1oZXJpLnRlc3QvbG9naW4iO3M6NToicm91dGUiO3M6NToibG9naW4iO31zOjY6Il9mbGFzaCI7YToyOntzOjM6Im9sZCI7YTowOnt9czozOiJuZXciO2E6MDp7fX19', 1775545860),
('vUsOtIn1EvhjUPJ3oYG0gqO05SNgh6anMFtyIvuW', NULL, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoia0c3T3p3Y0JLMk9XSTNqUDB1aVNFTVFVSDJQMUNMa09LMzk3UTZlOCI7czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MzE6Imh0dHBzOi8vc2tyaXBzaS1oZXJpLnRlc3QvbG9naW4iO3M6NToicm91dGUiO3M6NToibG9naW4iO319', 1774604708);

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

--
-- Table structure for table `stocks`
--

CREATE TABLE `stocks` (
  `id` bigint UNSIGNED NOT NULL,
  `business_id` bigint UNSIGNED DEFAULT NULL,
  `ingredient_id` bigint UNSIGNED NOT NULL,
  `type` enum('in','out','retur','rusak') COLLATE utf8mb4_unicode_ci NOT NULL,
  `quantity` decimal(12,2) NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_id` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `transactions`
--

CREATE TABLE `transactions` (
  `id` bigint UNSIGNED NOT NULL,
  `business_id` bigint UNSIGNED DEFAULT NULL,
  `user_id` bigint UNSIGNED NOT NULL,
  `total` decimal(12,2) NOT NULL,
  `payment_method` enum('tunai','non-tunai') COLLATE utf8mb4_unicode_ci NOT NULL,
  `paid_amount` decimal(12,2) NOT NULL,
  `change` decimal(12,2) NOT NULL,
  `note` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `transactions`
--

INSERT INTO `transactions` (`id`, `business_id`, `user_id`, `total`, `payment_method`, `paid_amount`, `change`, `note`, `created_at`, `updated_at`) VALUES
(1, 4, 6, 74000.00, 'tunai', 100000.00, 26000.00, 'Seeder transaksi awal - Warung Cak Wan', '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(2, 1, 2, 68000.00, 'tunai', 100000.00, 32000.00, 'Seeder transaksi awal - Warung Doyok', '2026-03-16 20:34:09', '2026-03-16 20:34:09');

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

--
-- Table structure for table `transaction_items`
--

CREATE TABLE `transaction_items` (
  `id` bigint UNSIGNED NOT NULL,
  `transaction_id` bigint UNSIGNED NOT NULL,
  `menu_id` bigint UNSIGNED NOT NULL,
  `quantity` int NOT NULL,
  `price` decimal(12,2) NOT NULL,
  `subtotal` decimal(12,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `transaction_items`
--

INSERT INTO `transaction_items` (`id`, `transaction_id`, `menu_id`, `quantity`, `price`, `subtotal`, `created_at`, `updated_at`) VALUES
(1, 1, 13, 1, 28000.00, 28000.00, '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(2, 1, 14, 2, 23000.00, 46000.00, '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(3, 2, 1, 1, 18000.00, 18000.00, '2026-03-16 20:34:09', '2026-03-16 20:34:09'),
(4, 2, 2, 2, 25000.00, 50000.00, '2026-03-16 20:34:09', '2026-03-16 20:34:09');

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

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` bigint UNSIGNED NOT NULL,
  `business_id` bigint UNSIGNED DEFAULT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `phone` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `role_id` bigint UNSIGNED NOT NULL,
  `email_verified_at` timestamp NULL DEFAULT NULL,
  `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `business_id`, `name`, `email`, `phone`, `address`, `role_id`, `email_verified_at`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 1, 'Admin Warung Doyok', 'admin.doyok@skripsiheri.test', '081200000001', 'Warung Doyok', 1, '2026-03-16 20:34:07', '$2y$12$WDzXKn1l6OIo...4BweaoecnK/lt1bL8J5T1S5vALxL6pV2qFugDG', 'PC3rBGsksuUI1HsFcMaeaOMWxbLd9ad3MS0zTbYPDkRdUFefwV83xWihg2ia', '2026-03-16 20:34:07', '2026-03-16 20:34:07'),
(2, 1, 'Kasir Warung Doyok', 'kasir.doyok@skripsiheri.test', '081200000002', 'Warung Doyok', 2, '2026-03-16 20:34:07', '$2y$12$AzI0VWLuzL6yFX49hcxLauHwRIm/GL0/ayp99tFSabycjQJqbpFA2', NULL, '2026-03-16 20:34:07', '2026-03-16 20:34:07'),
(3, 2, 'Admin Cak Mun', 'admin.cakmun@skripsiheri.test', '081200000003', 'Warung Cak Mun / Herawati', 1, '2026-03-16 20:34:08', '$2y$12$zdPZsjFCfKXQYpQ9R6TKvecSt/Fvbu7BenwzTfJaQVrjRepTS1GDu', NULL, '2026-03-16 20:34:08', '2026-03-16 20:34:08'),
(4, 3, 'Admin Pawon Asri', 'admin.pawon@skripsiheri.test', '081200000004', 'Warung Pawon Asri', 1, '2026-03-16 20:34:08', '$2y$12$O5Ok2.RzJSJJgks26MuKVut5SbLF/l0zfIaXodA.aZgOCYYHglDuu', NULL, '2026-03-16 20:34:08', '2026-03-16 20:34:08'),
(5, 4, 'Admin Cak Wan', 'admin.cakwan@skripsiheri.test', '081200000005', 'Warung Cak Wan', 1, '2026-03-16 20:34:08', '$2y$12$WTuESLpkKFsldr5aG6kHU.8lwqw.quDXNB//UCH92aYOmLrTJOo0y', NULL, '2026-03-16 20:34:08', '2026-03-16 20:34:08'),
(6, 4, 'Kasir Cak Wan', 'kasir.cakwan@skripsiheri.test', '081200000006', 'Warung Cak Wan', 2, '2026-03-16 20:34:09', '$2y$12$8jijrvIqY6WXFYhP9sCPQOaXUBAz6x2Qj.Hp8EBb1vuFMl6213KAu', NULL, '2026-03-16 20:34:09', '2026-03-16 20:34:09');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `businesses`
--
ALTER TABLE `businesses`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `businesses_name_unique` (`name`);

--
-- Indexes for table `cache`
--
ALTER TABLE `cache`
  ADD PRIMARY KEY (`key`),
  ADD KEY `cache_expiration_index` (`expiration`);

--
-- Indexes for table `cache_locks`
--
ALTER TABLE `cache_locks`
  ADD PRIMARY KEY (`key`),
  ADD KEY `cache_locks_expiration_index` (`expiration`);

--
-- Indexes for table `expenses`
--
ALTER TABLE `expenses`
  ADD PRIMARY KEY (`id`),
  ADD KEY `expenses_user_id_foreign` (`user_id`),
  ADD KEY `expenses_business_id_foreign` (`business_id`);

--
-- Indexes for table `ingredients`
--
ALTER TABLE `ingredients`
  ADD PRIMARY KEY (`id`),
  ADD KEY `ingredients_business_id_foreign` (`business_id`);

--
-- Indexes for table `menus`
--
ALTER TABLE `menus`
  ADD PRIMARY KEY (`id`),
  ADD KEY `menus_menu_category_id_foreign` (`menu_category_id`),
  ADD KEY `menus_business_id_foreign` (`business_id`);

--
-- Indexes for table `menu_categories`
--
ALTER TABLE `menu_categories`
  ADD PRIMARY KEY (`id`),
  ADD KEY `menu_categories_business_id_foreign` (`business_id`);

--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `password_reset_tokens`
--
ALTER TABLE `password_reset_tokens`
  ADD PRIMARY KEY (`email`);

--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `roles_name_unique` (`name`),
  ADD UNIQUE KEY `roles_code_unique` (`code`);

--
-- Indexes for table `sessions`
--
ALTER TABLE `sessions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sessions_user_id_index` (`user_id`),
  ADD KEY `sessions_last_activity_index` (`last_activity`);

--
-- Indexes for table `stocks`
--
ALTER TABLE `stocks`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stocks_ingredient_id_foreign` (`ingredient_id`),
  ADD KEY `stocks_user_id_foreign` (`user_id`),
  ADD KEY `stocks_business_id_foreign` (`business_id`);

--
-- Indexes for table `transactions`
--
ALTER TABLE `transactions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `transactions_user_id_foreign` (`user_id`),
  ADD KEY `transactions_business_id_foreign` (`business_id`);

--
-- Indexes for table `transaction_items`
--
ALTER TABLE `transaction_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `transaction_items_transaction_id_foreign` (`transaction_id`),
  ADD KEY `transaction_items_menu_id_foreign` (`menu_id`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `users_email_unique` (`email`),
  ADD KEY `users_role_id_foreign` (`role_id`),
  ADD KEY `users_business_id_foreign` (`business_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `businesses`
--
ALTER TABLE `businesses`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `expenses`
--
ALTER TABLE `expenses`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `ingredients`
--
ALTER TABLE `ingredients`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;

--
-- AUTO_INCREMENT for table `menus`
--
ALTER TABLE `menus`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;

--
-- AUTO_INCREMENT for table `menu_categories`
--
ALTER TABLE `menu_categories`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- AUTO_INCREMENT for table `roles`
--
ALTER TABLE `roles`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `stocks`
--
ALTER TABLE `stocks`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `transactions`
--
ALTER TABLE `transactions`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `transaction_items`
--
ALTER TABLE `transaction_items`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `expenses`
--
ALTER TABLE `expenses`
  ADD CONSTRAINT `expenses_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `businesses` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `expenses_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `ingredients`
--
ALTER TABLE `ingredients`
  ADD CONSTRAINT `ingredients_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `businesses` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `menus`
--
ALTER TABLE `menus`
  ADD CONSTRAINT `menus_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `businesses` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `menus_menu_category_id_foreign` FOREIGN KEY (`menu_category_id`) REFERENCES `menu_categories` (`id`);

--
-- Constraints for table `menu_categories`
--
ALTER TABLE `menu_categories`
  ADD CONSTRAINT `menu_categories_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `businesses` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `stocks`
--
ALTER TABLE `stocks`
  ADD CONSTRAINT `stocks_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `businesses` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `stocks_ingredient_id_foreign` FOREIGN KEY (`ingredient_id`) REFERENCES `ingredients` (`id`),
  ADD CONSTRAINT `stocks_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `transactions`
--
ALTER TABLE `transactions`
  ADD CONSTRAINT `transactions_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `businesses` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `transactions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `transaction_items`
--
ALTER TABLE `transaction_items`
  ADD CONSTRAINT `transaction_items_menu_id_foreign` FOREIGN KEY (`menu_id`) REFERENCES `menus` (`id`),
  ADD CONSTRAINT `transaction_items_transaction_id_foreign` FOREIGN KEY (`transaction_id`) REFERENCES `transactions` (`id`);

--
-- Constraints for table `users`
--
ALTER TABLE `users`
  ADD CONSTRAINT `users_business_id_foreign` FOREIGN KEY (`business_id`) REFERENCES `businesses` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `users_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`);
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
