[Update] code palanggan
This commit is contained in:
parent
8d84a54e79
commit
1e5c75f1dc
@ -58,10 +58,11 @@ class PelangganController extends Controller
|
||||
$validated = $request->validate($rules);
|
||||
|
||||
// 🔸 Generate kode undangan unik
|
||||
$invitationCode = 'INV-' . strtoupper(Str::random(6));
|
||||
while (Pelanggan::where('invitation_code', $invitationCode)->exists()) {
|
||||
$invitationCode = 'INV-' . strtoupper(Str::random(6));
|
||||
}
|
||||
// 🔸 Generate kode pelanggan unik (contoh: CUST-DJ3TJG)
|
||||
$kodePelanggan = 'CUST-' . strtoupper(Str::random(6));
|
||||
while (Pelanggan::where('kode_pelanggan', $kodePelanggan)->exists()) {
|
||||
$kodePelanggan = 'CUST-' . strtoupper(Str::random(6));
|
||||
}
|
||||
|
||||
// 🔸 Simpan pesanan baru
|
||||
$pelanggan = Pelanggan::create([
|
||||
|
||||
@ -60,7 +60,7 @@
|
||||
<tr class="hover:bg-gray-50">
|
||||
<th class="px-4 py-3 font-semibold bg-gray-50">Kode Undangan</th>
|
||||
<td class="px-4 py-3 font-mono text-indigo-600 font-semibold">
|
||||
{{ $pelanggan->invitation_code }}
|
||||
{{ $pelanggan->kode_pelanggan }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user