add model, controller, and seeder
This commit is contained in:
parent
9e085a79b4
commit
09eadb8a5a
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Additional extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'additionals';
|
||||||
|
protected $primaryKey = 'id_additional';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'nama',
|
||||||
|
'harga',
|
||||||
|
];
|
||||||
|
public function detailAdditional()
|
||||||
|
{
|
||||||
|
return $this->hasMany(DetailAdditional::class, 'id_additional');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class BookingFoto extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'booking_fotos';
|
||||||
|
protected $primaryKey = 'id_booking';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'no_invoice',
|
||||||
|
'id_pelanggan',
|
||||||
|
'id_paket',
|
||||||
|
'tgl_booking',
|
||||||
|
'jam_mulai',
|
||||||
|
'jam_selesai',
|
||||||
|
'total_bayar',
|
||||||
|
'bukti_bayar',
|
||||||
|
'status_booking',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function pelanggan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Pelanggan::class, 'id_pelanggan');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function paketFoto()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(PaketFoto::class, 'id_paket');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function detailAdditional()
|
||||||
|
{
|
||||||
|
return $this->hasMany(DetailAdditional::class, 'id_booking');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Buket extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'bukets';
|
||||||
|
protected $primaryKey = 'id_buket';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'nama',
|
||||||
|
'deskripsi',
|
||||||
|
'harga',
|
||||||
|
'foto',
|
||||||
|
'kategori', // Enum
|
||||||
|
'ukuran', // Enum
|
||||||
|
];
|
||||||
|
|
||||||
|
public function transaksi()
|
||||||
|
{
|
||||||
|
return $this->hasMany(TransaksiBuket::class, 'id_buket');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class DetailAdditional extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'detail_additionals';
|
||||||
|
protected $primaryKey = 'id_detail_additional';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'id_booking',
|
||||||
|
'id_additional',
|
||||||
|
'qty',
|
||||||
|
'subtotal',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function bookingFoto()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(BookingFoto::class, 'id_booking');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function additional()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Additional::class, 'id_additional');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class PaketFoto extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'paket_fotos';
|
||||||
|
protected $primaryKey = 'id_paket';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'nama',
|
||||||
|
'deskripsi',
|
||||||
|
'harga',
|
||||||
|
'foto',
|
||||||
|
'durasi',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function booking()
|
||||||
|
{
|
||||||
|
return $this->hasMany(BookingFoto::class, 'id_paket');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Pelanggan extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'pelanggans';
|
||||||
|
protected $primaryKey = 'id_pelanggan';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'nama',
|
||||||
|
'no_wa',
|
||||||
|
];
|
||||||
|
|
||||||
|
// Relasi
|
||||||
|
public function transaksiBuket()
|
||||||
|
{
|
||||||
|
return $this->hasMany(TransaksiBuket::class, 'id_pelanggan');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function bookingFoto()
|
||||||
|
{
|
||||||
|
return $this->hasMany(BookingFoto::class, 'id_pelanggan');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class TransaksiBuket extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'transaksi_bukets';
|
||||||
|
protected $primaryKey = 'id_transaksi';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'no_invoice',
|
||||||
|
'id_pelanggan',
|
||||||
|
'id_buket',
|
||||||
|
'request',
|
||||||
|
'tgl_ambil',
|
||||||
|
'total_bayar',
|
||||||
|
'bukti_bayar',
|
||||||
|
'status_transaksi',
|
||||||
|
];
|
||||||
|
|
||||||
|
// Relasi Balik
|
||||||
|
public function pelanggan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Pelanggan::class, 'id_pelanggan');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buket()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Buket::class, 'id_buket');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,47 +2,29 @@
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
|
|
||||||
class User extends Authenticatable
|
class User extends Authenticatable
|
||||||
{
|
{
|
||||||
/** @use HasFactory<\Database\Factories\UserFactory> */
|
|
||||||
use HasFactory, Notifiable;
|
use HasFactory, Notifiable;
|
||||||
|
|
||||||
/**
|
protected $table = 'users';
|
||||||
* The attributes that are mass assignable.
|
protected $primaryKey = 'id_user';
|
||||||
*
|
|
||||||
* @var list<string>
|
|
||||||
*/
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name',
|
'nama',
|
||||||
|
'username',
|
||||||
'email',
|
'email',
|
||||||
'password',
|
'password',
|
||||||
|
'no_wa',
|
||||||
|
'alamat',
|
||||||
|
'role',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* The attributes that should be hidden for serialization.
|
|
||||||
*
|
|
||||||
* @var list<string>
|
|
||||||
*/
|
|
||||||
protected $hidden = [
|
protected $hidden = [
|
||||||
'password',
|
'password',
|
||||||
'remember_token',
|
'remember_token',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the attributes that should be cast.
|
|
||||||
*
|
|
||||||
* @return array<string, string>
|
|
||||||
*/
|
|
||||||
protected function casts(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'email_verified_at' => 'datetime',
|
|
||||||
'password' => 'hashed',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,21 +12,16 @@
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('users', function (Blueprint $table) {
|
Schema::create('users', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id('id_user'); // Primary Key custom sesuai ERD
|
||||||
$table->string('name');
|
$table->string('nama');
|
||||||
|
$table->string('username')->unique();
|
||||||
$table->string('email')->unique();
|
$table->string('email')->unique();
|
||||||
$table->timestamp('email_verified_at')->nullable();
|
|
||||||
$table->string('password');
|
$table->string('password');
|
||||||
$table->rememberToken();
|
$table->string('no_wa', 20)->nullable();
|
||||||
|
$table->text('alamat')->nullable();
|
||||||
|
$table->enum('role', ['admin', 'pemilik']); // Enum Role
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
|
|
||||||
Schema::create('password_reset_tokens', function (Blueprint $table) {
|
|
||||||
$table->string('email')->primary();
|
|
||||||
$table->string('token');
|
|
||||||
$table->timestamp('created_at')->nullable();
|
|
||||||
});
|
|
||||||
|
|
||||||
Schema::create('sessions', function (Blueprint $table) {
|
Schema::create('sessions', function (Blueprint $table) {
|
||||||
$table->string('id')->primary();
|
$table->string('id')->primary();
|
||||||
$table->foreignId('user_id')->nullable()->index();
|
$table->foreignId('user_id')->nullable()->index();
|
||||||
|
|
@ -43,7 +38,6 @@ public function up(): void
|
||||||
public function down(): void
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('users');
|
Schema::dropIfExists('users');
|
||||||
Schema::dropIfExists('password_reset_tokens');
|
|
||||||
Schema::dropIfExists('sessions');
|
Schema::dropIfExists('sessions');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('bukets', function (Blueprint $table) {
|
||||||
|
$table->id('id_buket');
|
||||||
|
$table->string('nama');
|
||||||
|
$table->text('deskripsi')->nullable();
|
||||||
|
$table->decimal('harga', 10, 2); // Format uang
|
||||||
|
$table->string('foto')->nullable();
|
||||||
|
// Enum sesuai diskusi Wireframe & ERD
|
||||||
|
$table->enum('kategori', ['single', 'fresh', 'premium_fresh', 'artificial']);
|
||||||
|
$table->enum('ukuran', ['S', 'M', 'L']);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('bukets');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('paket_fotos', function (Blueprint $table) {
|
||||||
|
$table->id('id_paket');
|
||||||
|
$table->string('nama');
|
||||||
|
$table->text('deskripsi')->nullable();
|
||||||
|
$table->decimal('harga', 10, 2);
|
||||||
|
$table->string('foto')->nullable();
|
||||||
|
$table->integer('durasi'); // Dalam menit
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('paket_fotos');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('additionals', function (Blueprint $table) {
|
||||||
|
$table->id('id_additional');
|
||||||
|
$table->string('nama');
|
||||||
|
$table->decimal('harga', 10, 2);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('additionals');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('pelanggans', function (Blueprint $table) {
|
||||||
|
$table->id('id_pelanggan');
|
||||||
|
$table->string('nama');
|
||||||
|
$table->string('no_wa', 20);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('pelanggans');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('transaksi_bukets', function (Blueprint $table) {
|
||||||
|
$table->id('id_transaksi');
|
||||||
|
$table->string('no_invoice')->unique(); // Contoh: INV-BKT-001
|
||||||
|
|
||||||
|
// Foreign Keys
|
||||||
|
$table->foreignId('id_pelanggan')->constrained('pelanggans', 'id_pelanggan')->onDelete('cascade');
|
||||||
|
$table->foreignId('id_buket')->constrained('bukets', 'id_buket')->onDelete('cascade');
|
||||||
|
|
||||||
|
$table->text('request')->nullable(); // Catatan khusus
|
||||||
|
$table->dateTime('tgl_ambil');
|
||||||
|
$table->decimal('total_bayar', 12, 2);
|
||||||
|
$table->string('bukti_bayar')->nullable();
|
||||||
|
|
||||||
|
// Enum Status Final
|
||||||
|
$table->enum('status_transaksi', ['menunggu_verifikasi', 'diproses', 'selesai', 'dibatalkan'])->default('menunggu_verifikasi');
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('transaksi_bukets');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('booking_fotos', function (Blueprint $table) {
|
||||||
|
$table->id('id_booking');
|
||||||
|
$table->string('no_invoice')->unique(); // Contoh: INV-FOTO-001
|
||||||
|
|
||||||
|
// Foreign Keys
|
||||||
|
$table->foreignId('id_pelanggan')->constrained('pelanggans', 'id_pelanggan')->onDelete('cascade');
|
||||||
|
$table->foreignId('id_paket')->constrained('paket_fotos', 'id_paket')->onDelete('cascade');
|
||||||
|
|
||||||
|
$table->date('tgl_booking');
|
||||||
|
$table->time('jam_mulai');
|
||||||
|
$table->time('jam_selesai');
|
||||||
|
$table->decimal('total_bayar', 12, 2);
|
||||||
|
$table->string('bukti_bayar')->nullable();
|
||||||
|
|
||||||
|
// Enum Status Final
|
||||||
|
$table->enum('status_booking', ['menunggu_verifikasi', 'diproses', 'selesai', 'dibatalkan'])->default('menunggu_verifikasi');
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('booking_fotos');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('detail_additionals', function (Blueprint $table) {
|
||||||
|
$table->id('id_detail_additional');
|
||||||
|
|
||||||
|
// Foreign Keys
|
||||||
|
$table->foreignId('id_booking')->constrained('booking_fotos', 'id_booking')->onDelete('cascade');
|
||||||
|
$table->foreignId('id_additional')->constrained('additionals', 'id_additional')->onDelete('cascade');
|
||||||
|
|
||||||
|
$table->integer('qty');
|
||||||
|
$table->decimal('subtotal', 12, 2); // Harga Additional * Qty
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('detail_additionals');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
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],
|
||||||
|
];
|
||||||
|
|
||||||
|
DB::table('additionals')->insert($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class BuketSeeder extends Seeder
|
||||||
|
{
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
[
|
||||||
|
'nama' => 'Buket Mawar Merah Premium',
|
||||||
|
'harga' => 150000,
|
||||||
|
'deskripsi' => 'Buket mawar merah segar isi 10 tangkai dengan wrapping premium.',
|
||||||
|
'kategori' => 'fresh',
|
||||||
|
'ukuran' => 'S',
|
||||||
|
'foto' => 'img/buket/buket1.jpg',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'nama' => 'Snack Bouquet Choco',
|
||||||
|
'harga' => 75000,
|
||||||
|
'deskripsi' => 'Buket isi beng-beng, pocky, dan coklat silverqueen.',
|
||||||
|
'kategori' => 'single',
|
||||||
|
'ukuran' => 'M',
|
||||||
|
'foto' => 'img/buket/buket2.jpg',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'nama' => 'Money Bouquet 500k',
|
||||||
|
'harga' => 550000, // Harga jasa + uang
|
||||||
|
'deskripsi' => 'Buket uang pecahan 50rb total 500rb, jasa rangkai free kartu ucapan.',
|
||||||
|
'kategori' => 'artificial',
|
||||||
|
'ukuran' => 'L',
|
||||||
|
'foto' => 'img/buket/buket3.jpg',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
DB::table('bukets')->insert($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,24 +2,18 @@
|
||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use App\Models\User;
|
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
class DatabaseSeeder extends Seeder
|
class DatabaseSeeder extends Seeder
|
||||||
{
|
{
|
||||||
use WithoutModelEvents;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Seed the application's database.
|
|
||||||
*/
|
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
// User::factory(10)->create();
|
$this->call([
|
||||||
|
UserSeeder::class, // Akun Admin
|
||||||
User::factory()->create([
|
BuketSeeder::class, // Produk
|
||||||
'name' => 'Test User',
|
PaketFotoSeeder::class, // Produk
|
||||||
'email' => 'test@example.com',
|
AdditionalSeeder::class, // Tambahan
|
||||||
|
PelangganSeeder::class, // Customer Dummy
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class PaketFotoSeeder extends Seeder
|
||||||
|
{
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
[
|
||||||
|
'nama' => 'Wisuda Basic',
|
||||||
|
'harga' => 250000,
|
||||||
|
'deskripsi' => 'Foto wisuda outdoor 1 jam, 10 edit file, all file mentah.',
|
||||||
|
'foto' => 'img/foto/foto1.jpeg',
|
||||||
|
'durasi' => '60',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'nama' => 'Couple Studio Session',
|
||||||
|
'harga' => 350000,
|
||||||
|
'deskripsi' => 'Foto studio couple 45 menit, 2 cetak 10R, 5 edit file.',
|
||||||
|
'foto' => 'img/foto/foto2.jpeg',
|
||||||
|
'durasi' => '45',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'nama' => 'Group Photoshoot (Max 10 Orang)',
|
||||||
|
'harga' => 500000,
|
||||||
|
'deskripsi' => 'Foto grup, cocok untuk angkatan atau keluarga besar. Durasi 2 jam.',
|
||||||
|
'foto' => 'img/foto/foto3.jpeg',
|
||||||
|
'durasi' => '120',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
DB::table('paket_fotos')->insert($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class PelangganSeeder extends Seeder
|
||||||
|
{
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
[
|
||||||
|
'nama' => 'Siti Aminah',
|
||||||
|
'no_wa' => '081234567890',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'nama' => 'Budi Santoso',
|
||||||
|
'no_wa' => '089876543210',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
DB::table('pelanggans')->insert($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
|
||||||
|
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(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue