feat(order): where outlet by user dan memperbaiki push notification
This commit is contained in:
parent
44a63aa2f5
commit
614a4597a0
@ -137,7 +137,25 @@ public function columns(): array
|
|||||||
|
|
||||||
public function builder(): Builder
|
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')
|
return Order::select(
|
||||||
->with(['user', 'user.employee', 'customer', 'voucher']);
|
'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'))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -96,7 +96,7 @@ public function save()
|
|||||||
PushNotification::whereIn('user_id', $userIds)->get(),
|
PushNotification::whereIn('user_id', $userIds)->get(),
|
||||||
[
|
[
|
||||||
'title' => 'Order',
|
'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'),
|
'url' => route('studio.manage.order.index'),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user