diff --git a/app/Http/Controllers/BookingController.php b/app/Http/Controllers/BookingController.php index 03104f1..f4c95f7 100644 --- a/app/Http/Controllers/BookingController.php +++ b/app/Http/Controllers/BookingController.php @@ -2,10 +2,12 @@ namespace App\Http\Controllers; +use App\Mail\SendUniqueCode; use App\Models\BookingModel; use Carbon\Carbon; use Generator; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Mail; class BookingController extends Controller { @@ -87,6 +89,14 @@ public function store(Request $request) 'unix_expired_time' => $tgl_request ]); + Mail::to($request->email)->send(new SendUniqueCode( + $request->nama_lengkap, + $kode_unik, + date('H:i:s', $tgl_request - 86399), + date('H:i:s', $tgl_request), + $request->tgl_booking, + )); + return response()->json([ 'status' => true, 'msg' => 'Booking success!' diff --git a/app/Mail/SendUniqueCode.php b/app/Mail/SendUniqueCode.php new file mode 100644 index 0000000..be05174 --- /dev/null +++ b/app/Mail/SendUniqueCode.php @@ -0,0 +1,62 @@ + $this->code, + 'name' => $this->name, + 'startExpirationTime' => $this->startExpirationTime, + 'endExpirationTime' => $this->endExpirationTime, + 'tglExpired' => $this->tglExpired + ], + ); + } + + /** + * Get the attachments for the message. + * + * @return array + */ + public function attachments(): array + { + return []; + } +} diff --git a/resources/views/layouts/mail-send-code.blade.php b/resources/views/layouts/mail-send-code.blade.php new file mode 100644 index 0000000..9b1093c --- /dev/null +++ b/resources/views/layouts/mail-send-code.blade.php @@ -0,0 +1,273 @@ + + + + + + + Kode Unik Anda + + + + +
+ +
+ +

Smart Anxiety

+

Sistem Pendeteksi Kecemasan

+
+ + +
+

Halo! 👋

+ +

+ 🔑 Berikut adalah kode unik Anda untuk verifikasi booking: +

+ +
+

{{ $code }}

+
+ +
+

⏰ Penting: Kode unik ini akan berlaku pada tanggal {{ $tglExpired }}, dari jam {{ $startExpirationTime }} sampai {{ $endExpirationTime }}

+
+ + {{--
+

⚠️ Tidak meminta reset password? Abaikan email ini dan tidak ada perubahan yang akan + dilakukan pada akun Anda.

+
--}} + + {{-- --}} + +

+ Salam hangat,
+ Tim Smart Anxiety +

+
+ + + +
+ + + \ No newline at end of file diff --git a/resources/views/user/pages/index.blade.php b/resources/views/user/pages/index.blade.php index 82cdf50..e0e06c6 100644 --- a/resources/views/user/pages/index.blade.php +++ b/resources/views/user/pages/index.blade.php @@ -412,7 +412,14 @@