From dd70c72c9209aac52548dd4451fbbdc66adcdae2 Mon Sep 17 00:00:00 2001 From: Yoga Pangestu Date: Mon, 17 Nov 2025 23:23:37 +0700 Subject: [PATCH] refactor(push notification): merubah style message nya supaya lebih friendly dan menarik --- app/Livewire/Auth/Register.php | 4 ++-- app/Livewire/Forms/Auth/RegisterForm.php | 6 ++++-- app/Livewire/Forms/Studio/Finance/PayrollForm.php | 9 ++++----- app/Livewire/Forms/Studio/Manage/ArticleForm.php | 2 +- app/Livewire/Studio/Catalog/Perfume/Create.php | 4 ++-- app/Livewire/Studio/Loyalty/Voucher/Create.php | 4 ++-- app/Livewire/Studio/Manage/Article/Create.php | 5 +++-- app/Livewire/Studio/Manage/Order/Create.php | 5 ++--- 8 files changed, 20 insertions(+), 19 deletions(-) diff --git a/app/Livewire/Auth/Register.php b/app/Livewire/Auth/Register.php index 979c1e4..756c637 100644 --- a/app/Livewire/Auth/Register.php +++ b/app/Livewire/Auth/Register.php @@ -87,8 +87,8 @@ public function register() StorePushNotification::dispatch( PushNotification::whereIn('user_id', $userIds)->get(), [ - 'title' => 'Member Baru', - 'body' => 'Seorang member baru baru saja bergabung. Cek selengkapnya di aplikasi', + 'title' => 'πŸŽ‰Member Baru Bergabung!', + 'body' => 'Ada member baru saja. Yuk lihat profil lengkapnya di aplikasi! 🌟', 'url' => route('studio.loyalty.customer.index'), ], ); diff --git a/app/Livewire/Forms/Auth/RegisterForm.php b/app/Livewire/Forms/Auth/RegisterForm.php index 7278b68..5fddfa7 100644 --- a/app/Livewire/Forms/Auth/RegisterForm.php +++ b/app/Livewire/Forms/Auth/RegisterForm.php @@ -99,7 +99,7 @@ public function auth() $maxUser = User::max('id') + 1; $referralCode = ReferralCode::where('code', $this->referral_code)->first(); - DB::transaction(function () use ($tier, $maxUser, $referralCode) { + DB::transaction(function () use ($tier, $maxUser, $referralCode, &$customer) { $user = User::create([ 'email' => $this->email, 'username' => $this->username, @@ -107,7 +107,7 @@ public function auth() 'status' => UserStatus::ACTIVE, ]); - Customer::create([ + $customer = Customer::create([ 'user_id' => $user->id, 'name' => $this->name, 'phone_number' => $this->phone_number, @@ -148,5 +148,7 @@ public function auth() $user->sendEmailVerificationNotification(); }); + + return $customer->name; } } diff --git a/app/Livewire/Forms/Studio/Finance/PayrollForm.php b/app/Livewire/Forms/Studio/Finance/PayrollForm.php index 8a37bee..9872f12 100644 --- a/app/Livewire/Forms/Studio/Finance/PayrollForm.php +++ b/app/Livewire/Forms/Studio/Finance/PayrollForm.php @@ -79,16 +79,15 @@ public function store() $payroll->save(); } }); - - if ($adjustment->type == SalaryAdjustmentType::BONUS->value) { + if ($adjustment->type->value == SalaryAdjustmentType::BONUS->value) { return [ 'userIds' => $this->user_ids, - 'message' => 'Horee, Anda mendapatkan bonus sebesar '.currency($amount, 'Rp').' untuk bulan ini, Lihat detailnya di menu Penggajian.', + 'message' => 'πŸŽ‰ Horee! Anda mendapatkan bonus sebesar '.currency($amount, 'Rp').' untuk bulan ini. Lihat detailnya di menu Penggajian! πŸ’°βœ¨', ]; - } elseif ($adjustment->type == SalaryAdjustmentType::DEDUCTION->value) { + } elseif ($adjustment->type->value == SalaryAdjustmentType::DEDUCTION->value) { return [ 'userIds' => $this->user_ids, - 'message' => 'Yahh, gaji Anda dipotong sebesar '.currency($amount, 'Rp').' untuk bulan ini, Lihat detailnya di menu Penggajian.', + 'message' => '⚠️ Yahh, gaji Anda dipotong sebesar '.currency($amount, 'Rp').' untuk bulan ini. Lihat detailnya di menu Penggajian. πŸ“„', ]; } } diff --git a/app/Livewire/Forms/Studio/Manage/ArticleForm.php b/app/Livewire/Forms/Studio/Manage/ArticleForm.php index 1eaef66..e6d0e89 100644 --- a/app/Livewire/Forms/Studio/Manage/ArticleForm.php +++ b/app/Livewire/Forms/Studio/Manage/ArticleForm.php @@ -73,7 +73,7 @@ public function store() $this->uploadMedia($this->thumbnail, $article, 'thumbnail'); }); - return $article; + return $article->title; } public function update() diff --git a/app/Livewire/Studio/Catalog/Perfume/Create.php b/app/Livewire/Studio/Catalog/Perfume/Create.php index 78dc763..02e5f3e 100644 --- a/app/Livewire/Studio/Catalog/Perfume/Create.php +++ b/app/Livewire/Studio/Catalog/Perfume/Create.php @@ -47,8 +47,8 @@ public function save() StorePushNotification::dispatch( PushNotification::all(), [ - 'title' => 'Parfum', - 'body' => 'Ada yang baru nih! Aroma terbaru sudah siap kamu coba. Yuk intip dulu sebelum kehabisan.', + 'title' => '✨ Aroma Baru!', + 'body' => 'Ada yang baru nih! Aroma terbaru sudah siap kamu coba. Yuk cobain dulu sebelum kehabisan! 🌸✨', ], ); diff --git a/app/Livewire/Studio/Loyalty/Voucher/Create.php b/app/Livewire/Studio/Loyalty/Voucher/Create.php index a543a0a..8c2523c 100644 --- a/app/Livewire/Studio/Loyalty/Voucher/Create.php +++ b/app/Livewire/Studio/Loyalty/Voucher/Create.php @@ -36,8 +36,8 @@ public function save() StorePushNotification::dispatch( PushNotification::all(), [ - 'title' => 'Voucher', - 'body' => 'Ada voucher baru untuk kamu! Jangan sampai kelewatan, yuk cek sekarang dan nikmati penawarannya.', + 'title' => '🎁 Voucher Baru!', + 'body' => 'Ada voucher baru untuk kamu! Jangan sampai kelewatan, yuk cek sekarang dan nikmati penawarannya βœ¨πŸŽ‰', ], ); diff --git a/app/Livewire/Studio/Manage/Article/Create.php b/app/Livewire/Studio/Manage/Article/Create.php index d7275c9..1ed892c 100644 --- a/app/Livewire/Studio/Manage/Article/Create.php +++ b/app/Livewire/Studio/Manage/Article/Create.php @@ -8,6 +8,7 @@ use App\Traits\WithAuthorization; use App\Traits\WithToast; use App\Traits\WithUpdatedData; +use Illuminate\Support\Str; use Livewire\Attributes\Title; use Livewire\Component; @@ -27,8 +28,8 @@ public function save() StorePushNotification::dispatch( PushNotification::all(), [ - 'title' => 'Artikel', - 'body' => $result->title, + 'title' => 'πŸ“ Artikel Baru!', + 'body' => Str::limit($result, 50).' '.' ✨ Yuk baca selengkapnya di aplikasi!', ], ); diff --git a/app/Livewire/Studio/Manage/Order/Create.php b/app/Livewire/Studio/Manage/Order/Create.php index fb98143..6e98126 100644 --- a/app/Livewire/Studio/Manage/Order/Create.php +++ b/app/Livewire/Studio/Manage/Order/Create.php @@ -91,12 +91,11 @@ public function save() } $userIds = User::role(['Developer', 'Owner', 'Leader'])->pluck('id')->toArray(); - StorePushNotification::dispatch( PushNotification::whereIn('user_id', $userIds)->get(), [ - 'title' => 'Order', - 'body' => 'Ada order baru masuk dengan nominal '.currency($result['data']['total'], 'Rp'), + 'title' => 'πŸ›’ Order Baru!', + 'body' => 'Ada order baru masuk dengan nominal '.currency($result['data']['total'], 'Rp').' ✨', 'url' => route('studio.manage.order.index'), ], );