insyaallah revisi done

This commit is contained in:
Jagad R R
2025-01-23 17:46:38 +07:00
parent 6034c331c5
commit 3a01df56e9
32 changed files with 825 additions and 360 deletions
+9 -3
View File
@@ -6,7 +6,7 @@ use InvalidArgumentException;
class NotificationHelper
{
public static function newExpense($user_id, $expense_number, $receiver_ids = [])
public static function newExpense($expense_type, $expense_id, $user_id, $expense_number, $receiver_ids = [])
{
if (!is_array($receiver_ids) || empty($receiver_ids)) {
throw new InvalidArgumentException('Receiver IDs must be a non-empty array.');
@@ -22,6 +22,8 @@ class NotificationHelper
'content' => 'You have new expense waiting for approval (' . $expense_number . ')',
'is_read' => 0,
'type' => 'new_expense',
'expense_type' => $expense_type,
'expense_id' => $expense_id,
'created_at' => now(),
'updated_at' => now(),
];
@@ -31,7 +33,7 @@ class NotificationHelper
Notifications::insert($notifications);
}
public static function approveExpense($user_id, $expense_number, $receiver_ids = [])
public static function approveExpense($expense_type, $expense_id, $user_id, $expense_number, $receiver_ids = [])
{
if (!is_array($receiver_ids) || empty($receiver_ids)) {
throw new InvalidArgumentException('Receiver IDs must be a non-empty array.');
@@ -47,6 +49,8 @@ class NotificationHelper
'content' => 'You have new expense waiting for second approval (' . $expense_number . ')',
'is_read' => 0,
'type' => 'approve_expense',
'expense_type' => $expense_type,
'expense_id' => $expense_id,
'created_at' => now(),
'updated_at' => now(),
];
@@ -56,7 +60,7 @@ class NotificationHelper
Notifications::insert($notifications);
}
public static function approve2Expense($user_id, $expense_number, $receiver_ids = [])
public static function approve2Expense($expense_type, $expense_id, $user_id, $expense_number, $receiver_ids = [])
{
if (!is_array($receiver_ids) || empty($receiver_ids)) {
throw new InvalidArgumentException('Receiver IDs must be a non-empty array.');
@@ -72,6 +76,8 @@ class NotificationHelper
'content' => 'You have new expense waiting for final approval (' . $expense_number . ')',
'is_read' => 0,
'type' => 'approve2_expense',
'expense_type' => $expense_type,
'expense_id' => $expense_id,
'created_at' => now(),
'updated_at' => now(),
];