Update: 2026-05-08 15:18:01

This commit is contained in:
Hamza-Ayed
2026-05-08 15:18:01 +03:00
parent 7ea42f0f3b
commit 07fd3f9ba7
3 changed files with 85 additions and 8 deletions

View File

@@ -17,8 +17,15 @@ class NotificationService
public function __construct()
{
$this->projectId = env('FIREBASE_PROJECT_ID', '');
$this->serviceAccountPath = env('FIREBASE_SERVICE_ACCOUNT_PATH', APP_PATH . '/config/firebase-service-account.json');
// Auto-detect Project ID from Service Account JSON to prevent RESOURCE_PROJECT_INVALID
if (file_exists($this->serviceAccountPath)) {
$sa = json_decode(file_get_contents($this->serviceAccountPath), true);
$this->projectId = $sa['project_id'] ?? env('FIREBASE_PROJECT_ID', '');
} else {
$this->projectId = env('FIREBASE_PROJECT_ID', '');
}
}
/**