EVOLUTION-MANAGER
Edit File: BuscarArchivosGoogleDrive.php
<?php namespace App\Services; use Google_Client; use Google_Service_Drive; class GoogleDriveService { protected $client; protected $service; public function __construct() { $this->client = new Google_Client(); $this->client->setClientId(env('GOOGLE_DRIVE_CLIENT_ID')); $this->client->setClientSecret(env('GOOGLE_DRIVE_CLIENT_SECRET')); $this->client->refreshToken(env('GOOGLE_DRIVE_REFRESH_TOKEN')); $this->service = new Google_Service_Drive($this->client); } public function getFileMetadata($fileName) { $files = $this->service->files->listFiles([ 'q' => "name='$fileName'", 'fields' => 'files(id, name, mimeType, size, modifiedTime, createdTime)' ]); if (count($files->files) > 0) { return $files->files[0]; } else { return null; // No se encontró el archivo } } }