Merge branch 'main' of https://git.abbauf.com/Magang-2025/Undangan
This commit is contained in:
commit
155c1928fd
@ -5,6 +5,7 @@ namespace App\Http\Controllers\Api;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Pelanggan;
|
||||
use App\Models\PelangganDetail;
|
||||
use App\Models\Template; // ✅ tambahkan ini
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class KhitanApiController extends Controller
|
||||
@ -36,15 +37,20 @@ class KhitanApiController extends Controller
|
||||
'galeri' => 'nullable|string',
|
||||
]);
|
||||
|
||||
// ✅ Ambil template dari database
|
||||
$template = Template::with('kategori')->findOrFail($data['template_id']);
|
||||
|
||||
// ✅ Simpan ke tabel pelanggan
|
||||
$pelanggan = Pelanggan::create([
|
||||
'nama_pemesan' => $data['nama_pemesan'],
|
||||
'nama_template' => 'Template Khitan',
|
||||
'kategori' => 'khitan',
|
||||
'nama_template' => $template->nama_template,
|
||||
'kategori' => $template->kategori->nama ?? 'khitan',
|
||||
'email' => $data['email'],
|
||||
'no_tlpn' => $data['no_hp'],
|
||||
'harga' => 0,
|
||||
'harga' => $template->harga,
|
||||
]);
|
||||
|
||||
// ✅ Simpan detail form ke tabel pelanggan_details
|
||||
PelangganDetail::create([
|
||||
'pelanggan_id' => $pelanggan->id,
|
||||
'detail_form' => $data,
|
||||
|
@ -5,6 +5,7 @@ namespace App\Http\Controllers\Api;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Pelanggan;
|
||||
use App\Models\PelangganDetail;
|
||||
use App\Models\Template; // ✅ tambahkan ini
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class PernikahanApiController extends Controller
|
||||
@ -16,6 +17,7 @@ class PernikahanApiController extends Controller
|
||||
'nama_pemesan' => 'required|string|max:255',
|
||||
'no_hp' => 'required|string|max:20',
|
||||
'email' => 'required|email',
|
||||
|
||||
// Pria
|
||||
'nama_lengkap_pria' => 'required|string|max:255',
|
||||
'nama_panggilan_pria' => 'required|string|max:255',
|
||||
@ -56,15 +58,20 @@ class PernikahanApiController extends Controller
|
||||
'galeri' => 'nullable|string',
|
||||
]);
|
||||
|
||||
// ✅ Ambil template berdasarkan template_id
|
||||
$template = Template::with('kategori')->findOrFail($data['template_id']);
|
||||
|
||||
// ✅ Simpan ke tabel pelanggan
|
||||
$pelanggan = Pelanggan::create([
|
||||
'nama_pemesan' => $data['nama_pemesan'],
|
||||
'nama_template' => 'Template Pernikahan',
|
||||
'kategori' => 'pernikahan',
|
||||
'nama_template' => $template->nama_template,
|
||||
'kategori' => $template->kategori->nama ?? '-',
|
||||
'email' => $data['email'],
|
||||
'no_tlpn' => $data['no_hp'],
|
||||
'harga' => 0,
|
||||
'harga' => $template->harga,
|
||||
]);
|
||||
|
||||
// ✅ Simpan detail form ke tabel pelanggan_details
|
||||
PelangganDetail::create([
|
||||
'pelanggan_id' => $pelanggan->id,
|
||||
'detail_form' => $data,
|
||||
|
@ -5,6 +5,7 @@ namespace App\Http\Controllers\Api;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Pelanggan;
|
||||
use App\Models\PelangganDetail;
|
||||
use App\Models\Template; // ✅ tambahkan ini
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UlangTahunApiController extends Controller
|
||||
@ -17,7 +18,7 @@ class UlangTahunApiController extends Controller
|
||||
'no_hp' => 'required|string|max:20',
|
||||
'email' => 'required|email',
|
||||
|
||||
//Data
|
||||
// Data Anak
|
||||
'nama_lengkap_anak' => 'required|string|max:255',
|
||||
'nama_panggilan_anak' => 'required|string|max:100',
|
||||
'bapak_anak' => 'required|string|max:255',
|
||||
@ -25,7 +26,7 @@ class UlangTahunApiController extends Controller
|
||||
'umur_dirayakan' => 'required|string|max:10',
|
||||
'anak_ke' => 'required|string|max:5',
|
||||
|
||||
//Jadwal
|
||||
// Jadwal
|
||||
'hari_tanggal_acara' => 'required|date',
|
||||
'waktu_acara' => 'required|string|max:50',
|
||||
'alamat_acara' => 'required|string',
|
||||
@ -34,15 +35,20 @@ class UlangTahunApiController extends Controller
|
||||
'galeri' => 'nullable|string',
|
||||
]);
|
||||
|
||||
// ✅ Ambil template berdasarkan template_id
|
||||
$template = Template::with('kategori')->findOrFail($data['template_id']);
|
||||
|
||||
// ✅ Simpan ke tabel pelanggan
|
||||
$pelanggan = Pelanggan::create([
|
||||
'nama_pemesan' => $data['nama_pemesan'],
|
||||
'nama_template' => 'Template Ulang Tahun',
|
||||
'kategori' => 'ulang_tahun',
|
||||
'nama_template' => $template->nama_template,
|
||||
'kategori' => $template->kategori->nama ?? 'ulang_tahun',
|
||||
'email' => $data['email'],
|
||||
'no_tlpn' => $data['no_hp'],
|
||||
'harga' => 0,
|
||||
'harga' => $template->harga,
|
||||
]);
|
||||
|
||||
// ✅ Simpan detail form ke tabel pelanggan_details
|
||||
PelangganDetail::create([
|
||||
'pelanggan_id' => $pelanggan->id,
|
||||
'detail_form' => $data,
|
||||
|
Loading…
Reference in New Issue
Block a user