Update: 2026-05-08 15:18:01
This commit is contained in:
@@ -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', '');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user