feat(order): where outlet by user dan memperbaiki push notification

This commit is contained in:
Yoga Pangestu 2025-11-16 22:54:18 +07:00
parent 44a63aa2f5
commit 614a4597a0
2 changed files with 21 additions and 3 deletions

View File

@ -137,7 +137,25 @@ public function columns(): array
public function builder(): Builder
{
return Order::select('orders.id', 'orders.user_id', 'invoice_number', 'customer_id', 'orders.ordered_at', 'cogs', 'subtotal', 'discount', 'total', 'orders.status', 'channel', 'orders.voucher_id', 'orders.created_at')
->with(['user', 'user.employee', 'customer', 'voucher']);
return Order::select(
'orders.id',
'orders.user_id',
'invoice_number',
'customer_id',
'orders.ordered_at',
'cogs',
'subtotal',
'discount',
'total',
'orders.status',
'channel',
'orders.voucher_id',
'orders.created_at'
)
->with(['user', 'user.employee', 'customer', 'voucher'])
->whereHas(
'outlet',
fn ($q) => $q->whereIn('outlets.id', auth()->user()->outlets()->pluck('outlets.id'))
);
}
}

View File

@ -96,7 +96,7 @@ public function save()
PushNotification::whereIn('user_id', $userIds)->get(),
[
'title' => 'Order',
'body' => 'Ada order baru masuk dengan nominal '.$result->total,
'body' => 'Ada order baru masuk dengan nominal '.$result['data']['total'],
'url' => route('studio.manage.order.index'),
],
);