hasHeader('zoneId')) { $errors = []; array_push($errors, ['code' => 'zoneId', 'message' => 'Zone id is required!']); return response()->json([ 'errors' => $errors ], 403); } $zone_id= json_decode($request->header('zoneId'), true); try { $notifications = Notification::active()->where('tergat', 'customer')->where(function($q)use($zone_id){ $q->whereNull('zone_id')->orWhereIn('zone_id', $zone_id); })->where('created_at', '>=', \Carbon\Carbon::today()->subDays(15))->get(); $notifications->append('data'); $user_notifications = UserNotification::where('user_id', $request->user()->id)->where('created_at', '>=', \Carbon\Carbon::today()->subDays(15))->get(); $notifications = $notifications->merge($user_notifications); return response()->json($notifications, 200); } catch (\Exception $e) { info(['Notification api issue_____',$e->getMessage()]); return response()->json([], 200); } } }