芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/store.kwesioben.com/app/Http/Controllers/api/v1/NotificationController.php
where(['sent_to'=>'customer']); $notification = $notification_data->with('notification_seen_by') ->latest()->paginate($request['limit'], ['*'], 'page', $request['offset']); return [ 'total_size' => $notification->total(), 'limit' => (int)$request['limit'], 'offset' => (int)$request['offset'], 'new_notification' => $notification_data->whereDoesntHave('notification_seen_by')->count(), 'notification' => $notification->items() ]; } public function notification_seen(Request $request) { $user = $request->user(); NotificationSeen::updateOrInsert(['user_id' => $user->id, 'notification_id' => $request->id],[ 'created_at' => Carbon::now(), ]); $notification_count = Notification::active() ->where('sent_to', 'customer') ->whereDoesntHave('notification_seen_by') ->count(); return [ 'notification_count' => $notification_count, ]; } }