34 lines
852 B
PHP
34 lines
852 B
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use Illuminate\Support\Facades\Log;
|
|
use Throwable;
|
|
|
|
class GoogleDriveService
|
|
{
|
|
// TODO: isi path credentials service account (JSON) & folder ID tujuan setelah tersedia.
|
|
private string $credentialsPath = '';
|
|
|
|
private string $folderId = '';
|
|
|
|
public function uploadPdf(string $content, string $fileName): string|false
|
|
{
|
|
if (! $this->credentialsPath || ! $this->folderId) {
|
|
Log::error("GoogleDriveService: belum dikonfigurasi, upload '$fileName' dilewati.");
|
|
|
|
return false;
|
|
}
|
|
|
|
try {
|
|
// TODO: implementasi upload pakai google/apiclient setelah credentials tersedia.
|
|
} catch (Throwable $th) {
|
|
Log::error('GoogleDriveService uploadPdf : '.$th->getMessage());
|
|
|
|
return false;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|