add new seeder (additional, pelangan, transaksi, user)

This commit is contained in:
LailaWulandarii 2025-12-30 02:58:47 +07:00
parent 297ee8817d
commit a82f3a3540
4 changed files with 259 additions and 28 deletions

View File

@ -10,11 +10,13 @@ class AdditionalSeeder extends Seeder
public function run(): void
{
$data = [
['nama' => 'Timer', 'harga' => 5000],
['nama' => 'Kostum boneka', 'harga' => 35000],
['nama' => 'Bando Kucing', 'harga' => 10000],
['nama' => 'Spotlight', 'harga' => 15000],
['nama' => 'Cetak', 'harga' => 5000],
['nama' => 'Tambah orang untuk paket group termasuk 1 print out foto ukuran 4R', 'harga' => 15000],
['nama' => 'Kostum Boneka (Onesize)/orang', 'harga' => 10000],
['nama' => 'Tambah print out foto ukuran 4R/lembar', 'harga' => 7000],
['nama' => 'Tambah waktu/5 menit', 'harga' => 15000],
['nama' => 'Take all soft file via google drive berlaku selama 7 hari', 'harga' => 20000],
['nama' => 'Tambah 10 menit sesi Spotlight', 'harga' => 25000],
['nama' => 'Tambah cetak pas foto/lembar', 'harga' => 7000],
];
DB::table('additionals')->insert($data);

View File

@ -12,11 +12,11 @@ public function run(): void
$data = [
[
'nama' => 'Siti Aminah',
'no_wa' => '081234567890',
'no_wa' => '089673668516',
],
[
'nama' => 'Budi Santoso',
'no_wa' => '089876543210',
'no_wa' => '+62 813-3439-4400',
],
];

View File

@ -0,0 +1,215 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Carbon\Carbon;
use Illuminate\Support\Facades\Schema; // Tambahkan ini di atas
class TransaksiSeeder extends Seeder
{
public function run(): void
{
// 1. Matikan pengecekan Foreign Key sementara (Supaya bisa hapus data sembarangan)
Schema::disableForeignKeyConstraints();
// 2. Kosongkan tabel sebelum diisi ulang (Urutan gak masalah karena FK dimatikan)
DB::table('detail_additionals')->truncate();
DB::table('booking_fotos')->truncate();
DB::table('transaksi_bukets')->truncate();
// 3. Nyalakan lagi pengecekan Foreign Key
Schema::enableForeignKeyConstraints();
$buketData = [
[
'no_invoice' => 'INV-BKT-' . time() . '01',
'id_pelanggan' => 1, // Pastikan ID ini ada di tabel pelanggans
'id_buket' => 1, // Buket Mawar (Harga: 150000)
'request' => 'tema navy',
'ucapan' => '"Happy Graduation Sayang"',
'tgl_ambil' => Carbon::now()->addDays(2)->format('Y-m-d H:i:s'),
'total_bayar' => 150000,
'bukti_bayar' => 'img/payment/buket/bukti1.jpg',
'status_transaksi' => 'selesai',
'created_at' => now(),
'updated_at' => now(),
],
[
'no_invoice' => 'INV-BKT-' . time() . '02',
'id_pelanggan' => 2,
'id_buket' => 2, // Snack Bouquet (Harga: 75000)
'request' => 'Snacknya jangan yang pedas',
'ucapan' => 'semangat bub',
'tgl_ambil' => Carbon::now()->subDays(1)->format('Y-m-d H:i:s'), // Sudah lewat
'total_bayar' => 75000,
'bukti_bayar' => 'img/payment/buket/bukti2.jpg',
'status_transaksi' => 'diterima',
'created_at' => now()->subDays(2),
'updated_at' => now()->subDays(1),
],
[
'no_invoice' => 'INV-BKT-' . time() . '03',
'id_pelanggan' => 2,
'id_buket' => 1, // Snack Bouquet (Harga: 75000)
'request' => 'Snacknya jangan yang pedas',
'ucapan' => 'semangat bub',
'tgl_ambil' => Carbon::now()->subDays(1)->format('Y-m-d H:i:s'), // Sudah lewat
'total_bayar' => 75000,
'bukti_bayar' => 'img/payment/buket/bukti2.jpg',
'status_transaksi' => 'ditolak',
'created_at' => now()->subDays(2),
'updated_at' => now()->subDays(1),
],
[
'no_invoice' => 'INV-BKT-' . time() . '04',
'id_pelanggan' => 2,
'id_buket' => 3, // Snack Bouquet (Harga: 75000)
'request' => 'Snacknya jangan yang pedas',
'ucapan' => 'semangat bub',
'tgl_ambil' => Carbon::now()->subDays(1)->format('Y-m-d H:i:s'), // Sudah lewat
'total_bayar' => 75000,
'bukti_bayar' => 'img/payment/buket/bukti2.jpg',
'status_transaksi' => 'menunggu_verifikasi',
'created_at' => now()->subDays(2),
'updated_at' => now()->subDays(1),
],
[
'no_invoice' => 'INV-BKT-' . time() . '05',
'id_pelanggan' => 1,
'id_buket' => 3, // Snack Bouquet (Harga: 75000)
'request' => 'Snacknya jangan yang pedas',
'ucapan' => 'semangat bub',
'tgl_ambil' => Carbon::now()->subDays(1)->format('Y-m-d H:i:s'), // Sudah lewat
'total_bayar' => 75000,
'bukti_bayar' => 'img/payment/buket/bukti2.jpg',
'status_transaksi' => 'menunggu_verifikasi',
'created_at' => now()->subDays(2),
'updated_at' => now()->subDays(1),
]
];
DB::table('transaksi_bukets')->insert($buketData);
// --- 2. SEEDER BOOKING FOTO ---
$fotoData = [
[
'id_booking' => 1, // Kita set manual ID biar gampang relasi ke additional
'no_invoice' => 'INV-FOTO-' . time() . '01',
'id_pelanggan' => 1,
'id_paket' => 1, // Wisuda Basic (Harga: 250000)
'tgl_booking' => Carbon::now()->addDays(5)->format('Y-m-d'),
'jam_mulai' => '09:00:00',
'jam_selesai' => '10:00:00', // Durasi 60 menit sesuai paket
'total_bayar' => 250000 + 10000, // Harga Paket + Additional (Bando)
'bukti_bayar' => 'img/payment/foto/bukti1.jpg',
'status_booking' => 'diterima',
'created_at' => now(),
'updated_at' => now(),
],
[
'id_booking' => 2,
'no_invoice' => 'INV-FOTO-' . time() . '02',
'id_pelanggan' => 2,
'id_paket' => 2, // Couple Studio (Harga: 350000)
'tgl_booking' => Carbon::now()->addDays(1)->format('Y-m-d'),
'jam_mulai' => '13:00:00',
'jam_selesai' => '13:45:00', // Durasi 45 menit
'total_bayar' => 350000 + (35000 * 2), // Paket + (Kostum * 2)
'bukti_bayar' => 'img/payment/foto/bukti1.jpg',
'status_booking' => 'ditolak',
'created_at' => now(),
'updated_at' => now(),
],
[
'id_booking' => 3,
'no_invoice' => 'INV-FOTO-' . time() . '03',
'id_pelanggan' => 1,
'id_paket' => 2, // Couple Studio (Harga: 350000)
'tgl_booking' => Carbon::now()->addDays(1)->format('Y-m-d'),
'jam_mulai' => '13:00:00',
'jam_selesai' => '13:45:00', // Durasi 45 menit
'total_bayar' => 350000 + (35000 * 2), // Paket + (Kostum * 2)
'bukti_bayar' => 'img/payment/foto/bukti1.jpg',
'status_booking' => 'menunggu_verifikasi',
'created_at' => now(),
'updated_at' => now(),
],
[
'id_booking' => 4,
'no_invoice' => 'INV-FOTO-' . time() . '04',
'id_pelanggan' => 2,
'id_paket' => 2, // Couple Studio (Harga: 350000)
'tgl_booking' => Carbon::now()->addDays(1)->format('Y-m-d'),
'jam_mulai' => '13:00:00',
'jam_selesai' => '13:45:00', // Durasi 45 menit
'total_bayar' => 350000 + (35000 * 2), // Paket + (Kostum * 2)
'bukti_bayar' => 'img/payment/foto/bukti1.jpg',
'status_booking' => 'menunggu_verifikasi',
'created_at' => now(),
'updated_at' => now(),
],
[
'id_booking' => 5,
'no_invoice' => 'INV-FOTO-' . time() . '05',
'id_pelanggan' => 1,
'id_paket' => 2, // Couple Studio (Harga: 350000)
'tgl_booking' => Carbon::now()->addDays(1)->format('Y-m-d'),
'jam_mulai' => '13:00:00',
'jam_selesai' => '13:45:00', // Durasi 45 menit
'total_bayar' => 350000 + (35000 * 2), // Paket + (Kostum * 2)
'bukti_bayar' => 'img/payment/foto/bukti1.jpg',
'status_booking' => 'selesai',
'created_at' => now(),
'updated_at' => now(),
]
];
DB::table('booking_fotos')->insert($fotoData);
// --- 3. SEEDER DETAIL ADDITIONAL (Relasi ke Booking Foto) ---
$additionalData = [
// SKENARIO 1: Booking ID 1 (Satu Item Additional)
[
'id_booking' => 4,
'id_additional' => 3, // Bando Kucing
'qty' => 1,
'subtotal' => 10000,
'created_at' => now(),
'updated_at' => now(),
],
[
'id_booking' => 4,
'id_additional' => 2, // Bando Kucing
'qty' => 1,
'subtotal' => 10000,
'created_at' => now(),
'updated_at' => now(),
],
// SKENARIO 2: Booking ID 3 (Dua Item Additional Berbeda)
// Item Pertama
[
'id_booking' => 3,
'id_additional' => 2, // Kostum Boneka
'qty' => 1,
'subtotal' => 35000,
'created_at' => now(),
'updated_at' => now(),
],
// Item Kedua
[
'id_booking' => 3,
'id_additional' => 3, // Bando Kucing
'qty' => 2,
'subtotal' => 20000, // 2 x 10000
'created_at' => now(),
'updated_at' => now(),
],
];
DB::table('detail_additionals')->insert($additionalData);
}
}

View File

@ -10,26 +10,40 @@ class UserSeeder extends Seeder
{
public function run(): void
{
DB::table('users')->insert([
'nama' => 'Bilqis',
'username' => 'admin1',
'email' => 'admin@flodo.com',
'password' => Hash::make('password123'),
'no_wa' => '0893781263',
'alamat' => 'Kauman',
'role' => 'admin',
'created_at' => now(),
'updated_at' => now(),
], [
'nama' => 'Debby',
'username' => 'ownerdebby',
'email' => 'debby@flodo.com',
'password' => Hash::make('password123'),
'no_wa' => '0893781263',
'alamat' => 'Kauman',
'role' => 'owner',
'created_at' => now(),
'updated_at' => now(),
]);
DB::table('users')->insert([ // <-- Perhatikan kurung siku pembuka ini
[
'nama' => 'Bilqis',
'username' => 'admin1',
'email' => 'admin@flodo.com',
'password' => Hash::make('password123'),
'no_wa' => '0893781263',
'alamat' => 'Kauman',
'role' => 'admin_buket',
'created_at' => now(),
'updated_at' => now(),
],
[
'nama' => 'Ayu',
'username' => 'admin2',
'email' => 'admin2@flodo.com',
'password' => Hash::make('password123'),
'no_wa' => '08937812890',
'alamat' => 'Kauman',
'role' => 'admin_foto',
'created_at' => now(),
'updated_at' => now(),
],
[
'nama' => 'Debby',
'username' => 'ownerdebby',
'email' => 'debby@flodo.com',
'password' => Hash::make('password123'),
'no_wa' => '0893781263',
'alamat' => 'Kauman',
'role' => 'pemilik',
'created_at' => now(),
'updated_at' => now(),
]
]); // <-- Dan kurung siku penutup ini
}
}