Skip to content

Commit

Permalink
update: get user notifucation payload
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad235 committed Aug 24, 2024
1 parent 28d21bd commit 871480f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions app/Console/Commands/StoreApiStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use DateTime;
use DateTimeZone;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Http;

class StoreApiStatus extends Command
Expand Down Expand Up @@ -70,7 +69,7 @@ public function handle()
'details' => $this->getDetails($execution)
];

$url = config('app.url') . '/api/v1/api-status';
$url = "https://staging.api-php.boilerplate.hng.tech/api/v1/api-status";

$response = Http::post($url, $data);

Expand Down
8 changes: 4 additions & 4 deletions app/Http/Controllers/UserNotificationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ public function create(CreateNotificationRequest $request)

// Return 201
return response()->json([
'status' => 'success',
'message' => 'Notification created successfully',
'status_code' => 201,
'data' => [
Expand Down Expand Up @@ -115,18 +114,19 @@ public function getByUser(Request $request)
$isRead = $notification->pivot->status === 'read';
return [
'id' => $notification->id,
'message' => $notification->message,
'user_id' => auth()->id(),
'is_read' => $isRead,
'message' => $notification->message,
'created_at' => $notification->created_at,
'updated_at' => $notification->updated_at,
];
});

//
$status = $isRead === 'false' ? 'Unread ' : '';

return response()->json([
'status' => 'success',
'message' => "{$status}Notifications retrieved successfully",
'message' => "{$status}Notification retrieved successfully",
'status_code' => Response::HTTP_OK,
'data' => [
'total_notification_count' => $totalNotificationsCount,
Expand Down

0 comments on commit 871480f

Please sign in to comment.