From 1aff61aeceda91cf3a0a0dec4fe3f6858b7720f3 Mon Sep 17 00:00:00 2001 From: amirghasempoor Date: Mon, 14 Jul 2025 16:58:29 +0330 Subject: [PATCH] add total for notification --- app/Http/Controllers/V3/NotificationController.php | 2 ++ app/Http/Controllers/V3/RahdaranController.php | 14 ++++---------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/app/Http/Controllers/V3/NotificationController.php b/app/Http/Controllers/V3/NotificationController.php index 23c928f6..b05f9f72 100644 --- a/app/Http/Controllers/V3/NotificationController.php +++ b/app/Http/Controllers/V3/NotificationController.php @@ -215,6 +215,8 @@ class NotificationController extends Controller ])->count(); } + $missions['total'] = $missions['request_portal'] + $missions['transportation'] + $missions['control']; + return $missions; } } diff --git a/app/Http/Controllers/V3/RahdaranController.php b/app/Http/Controllers/V3/RahdaranController.php index 12ebc614..e287ff84 100644 --- a/app/Http/Controllers/V3/RahdaranController.php +++ b/app/Http/Controllers/V3/RahdaranController.php @@ -61,16 +61,10 @@ class RahdaranController extends Controller public function search(Request $request): JsonResponse { - if ($request->has('code')) { - $matchedSearchedRahdaran = Rahdaran::query() - ->where('code', 'LIKE', "%{$request->code}%") - ->get(); - } - else { - $matchedSearchedRahdaran = Rahdaran::query() - ->where('name', 'LIKE', "%{$request->name}%") - ->get(); - } + $matchedSearchedRahdaran = Rahdaran::query() + ->where('code', 'LIKE', "%{$request->search}%") + ->orWhere('name', 'LIKE', "%{$request->search}%") + ->get(); return $this->successResponse($matchedSearchedRahdaran); }