Browse Source

added export bdtdevices to gsheet

= 3 years ago
parent
commit
fe79d4f3bc

+ 150 - 0
app/Console/Commands/recordsToGsheet.php

@@ -0,0 +1,150 @@
+<?php
+
+namespace App\Console\Commands;
+
+use App\Models\BDTDevice;
+use App\Models\Client;
+use App\Models\SimpleProduct;
+use Google\Service\Sheets\ValueRange;
+use Google_Client;
+use Illuminate\Console\Command;
+use Revolution\Google\Sheets\Facades\Sheets;
+use Revolution\Google\Sheets\Sheets as SheetsSheets;
+
+class recordsToGsheet extends Command
+{
+  
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'records:export-to-gsheet';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = 'Export records to gsheet';
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * Execute the console command.
+     *
+     * @return int
+     */
+    public function handle()
+    {
+        $this->pushSheet();
+        return 0;
+    }
+
+
+    function pushSheet(){
+
+        $spreadsheetId = config('app.googleSpreadsheetId');
+        $googleSpreadsheetProductsSheetName = config('app.googleSpreadsheetProductsSheetName'); 
+       
+        $client = $this->getApiClient();
+        $service = new \Google\Service\Sheets($client);
+
+        
+        $values = $this->getValues();
+
+
+        $range = $googleSpreadsheetProductsSheetName.'!A1:V1';
+        $body = new ValueRange([
+            'values' => $values
+        ]);
+        $params = [
+           'valueInputOption' => 'RAW'
+        ];
+
+        $result = $service->spreadsheets_values->append($spreadsheetId, $range, $body, $params);
+
+        $this->info(json_encode($result));
+
+    }
+
+
+    function getApiClient(){
+      
+        $KEY_FILE_LOCATION = storage_path('stag-gsheets-d9ead2f78b4b.json');
+
+        $client = new Google_Client();
+        $client->setApplicationName("My Rooster Admin");
+        $client->setAuthConfig($KEY_FILE_LOCATION);
+        
+        $client->setScopes([\Google\Service\Sheets::DRIVE, \Google\Service\Sheets::SPREADSHEETS]);
+
+        return $client;
+
+    }
+
+
+    private function getValues(){
+
+        $values = [];
+
+        $values[] = [
+            'Device Type',
+			'IMEI',
+			'Issued Yet?',
+			'Client',
+			'Used?',
+			'MCP',
+			'Issue Date',
+			'Last Meas. Date',
+			'Last Meas. Days Ago',
+			'Days with Remote Meas. this Month',
+			'Days with Remote Meas. last Month',
+			'Client Engagement Status Category',
+			'Admin Engagement Assessment Status',
+			'Mcp Engagement Assessment Status',
+			'Default Na Engagement Assessment Status',
+        ];
+
+        BDTDevice::chunk(1, function($bdtDevices) use (&$values){
+            foreach($bdtDevices as $bdtDevice){
+                $bdtDeviceStr =  $bdtDevice->category.'~~'.
+                    $bdtDevice->imei.'~~'.
+                    ($bdtDevice->clientBDTDevice ? 'Yes': 'No').'~~'.
+                    ($bdtDevice->clientBDTDevice?$bdtDevice->clientBDTDevice->client->displayName():'-').'~~'.
+                    ($bdtDevice->clientBDTDevice && $bdtDevice->clientBDTDevice->mostRecentMeasurement ? 'Yes': 'No').'~~'.
+                    ($bdtDevice->clientBDTDevice && $bdtDevice->clientBDTDevice->client->mcp ? $bdtDevice->clientBDTDevice->client->mcp->name_first.' '.$bdtDevice->clientBDTDevice->client->mcp->name_last:'-').'~~'.
+                    ($bdtDevice->clientBdtDevice? friendly_date_time($bdtDevice->clientBDTDevice->created_at) : '-').'~~'.
+                    ($bdtDevice->clientBDTDevice && $bdtDevice->clientBDTDevice->mostRecentMeasurement ? friendly_date_time($bdtDevice->clientBDTDevice->mostRecentMeasurement->measurement->ts_date_time) : '-').'~~'.
+                    ($bdtDevice->clientBDTDevice && $bdtDevice->clientBDTDevice->mostRecentMeasurement ? (date_diff(date_create($bdtDevice->clientBDTDevice->mostRecentMeasurement->measurement->ts_date_time), date_create('now'))->days) : '-').'~~'.
+                    (($bdtDevice->clientBDTDevice && $bdtDevice->clientBDTDevice->client->currentCareMonth()) ? $bdtDevice->clientBDTDevice->client->currentCareMonth()->number_of_days_with_remote_measurements:'-').'~~'.
+                    (($bdtDevice->clientBDTDevice && $bdtDevice->clientBDTDevice->client->previousCareMonth()) ? $bdtDevice->clientBDTDevice->client->previousCareMonth()->number_of_days_with_remote_measurements:'-').'~~'.
+                    @$bdtDevice->clientBDTDevice->client->client_engagement_status_category.'~~'.
+                    @$bdtDevice->clientBDTDevice->client->adminEngagementAssessmentStatus->status_category.'~~'.
+                    @$bdtDevice->clientBDTDevice->client->mcpEngagementAssessmentStatus->status_category.'~~'.
+                    @$bdtDevice->clientBDTDevice->client->defaultNaEngagementAssessmentStatus->status_category.'~~';
+                $values[] = explode('~~', $bdtDeviceStr);
+            }
+        });
+
+        return $values;
+    }
+
+    
+}
+
+				
+			
+			
+				
+			
+				
+				

+ 1 - 0
composer.json

@@ -19,6 +19,7 @@
         "laravel/framework": "^7.0",
         "laravel/tinker": "^2.0",
         "picqer/php-barcode-generator": "^2.1",
+        "revolution/laravel-google-sheets": "^5.8",
         "soundasleep/html2text": "^1.1"
     },
     "require-dev": {

+ 632 - 2
composer.lock

@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "afcf90be7410c699587a1a4954346390",
+    "content-hash": "34df0ad7656ca9400a6f4e20eb6b5ea4",
     "packages": [
         {
             "name": "asm89/stack-cors",
@@ -909,6 +909,63 @@
             ],
             "time": "2020-06-23T01:36:47+00:00"
         },
+        {
+            "name": "firebase/php-jwt",
+            "version": "v5.5.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/firebase/php-jwt.git",
+                "reference": "83b609028194aa042ea33b5af2d41a7427de80e6"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/firebase/php-jwt/zipball/83b609028194aa042ea33b5af2d41a7427de80e6",
+                "reference": "83b609028194aa042ea33b5af2d41a7427de80e6",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.0"
+            },
+            "require-dev": {
+                "phpunit/phpunit": ">=4.8 <=9"
+            },
+            "suggest": {
+                "paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "Firebase\\JWT\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Neuman Vong",
+                    "email": "neuman+pear@twilio.com",
+                    "role": "Developer"
+                },
+                {
+                    "name": "Anant Narayanan",
+                    "email": "anant@php.net",
+                    "role": "Developer"
+                }
+            ],
+            "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
+            "homepage": "https://github.com/firebase/php-jwt",
+            "keywords": [
+                "jwt",
+                "php"
+            ],
+            "support": {
+                "issues": "https://github.com/firebase/php-jwt/issues",
+                "source": "https://github.com/firebase/php-jwt/tree/v5.5.1"
+            },
+            "time": "2021-11-08T20:18:51+00:00"
+        },
         {
             "name": "fruitcake/laravel-cors",
             "version": "v1.0.6",
@@ -977,6 +1034,175 @@
             ],
             "time": "2020-04-28T08:47:37+00:00"
         },
+        {
+            "name": "google/apiclient",
+            "version": "v2.10.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/googleapis/google-api-php-client.git",
+                "reference": "11871e94006ce7a419bb6124d51b6f9ace3f679b"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/googleapis/google-api-php-client/zipball/11871e94006ce7a419bb6124d51b6f9ace3f679b",
+                "reference": "11871e94006ce7a419bb6124d51b6f9ace3f679b",
+                "shasum": ""
+            },
+            "require": {
+                "firebase/php-jwt": "~2.0||~3.0||~4.0||~5.0",
+                "google/apiclient-services": "~0.200",
+                "google/auth": "^1.10",
+                "guzzlehttp/guzzle": "~5.3.3||~6.0||~7.0",
+                "guzzlehttp/psr7": "^1.2",
+                "monolog/monolog": "^1.17|^2.0",
+                "php": "^5.6|^7.0|^8.0",
+                "phpseclib/phpseclib": "~2.0||^3.0.2"
+            },
+            "require-dev": {
+                "cache/filesystem-adapter": "^0.3.2|^1.1",
+                "composer/composer": "^1.10.22",
+                "dealerdirect/phpcodesniffer-composer-installer": "^0.7",
+                "phpcompatibility/php-compatibility": "^9.2",
+                "phpunit/phpunit": "^5.7||^8.5.13",
+                "squizlabs/php_codesniffer": "~2.3",
+                "symfony/css-selector": "~2.1",
+                "symfony/dom-crawler": "~2.1"
+            },
+            "suggest": {
+                "cache/filesystem-adapter": "For caching certs and tokens (using Google\\Client::setCache)"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "2.x-dev"
+                }
+            },
+            "autoload": {
+                "files": [
+                    "src/aliases.php"
+                ],
+                "psr-4": {
+                    "Google\\": "src/"
+                },
+                "classmap": [
+                    "src/aliases.php"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "description": "Client library for Google APIs",
+            "homepage": "http://developers.google.com/api-client-library/php",
+            "keywords": [
+                "google"
+            ],
+            "support": {
+                "issues": "https://github.com/googleapis/google-api-php-client/issues",
+                "source": "https://github.com/googleapis/google-api-php-client/tree/v2.10.1"
+            },
+            "time": "2021-06-25T14:25:44+00:00"
+        },
+        {
+            "name": "google/apiclient-services",
+            "version": "v0.238.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/googleapis/google-api-php-client-services.git",
+                "reference": "a9866fd963f53e9a7d26d36f20c471f73a90a719"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/a9866fd963f53e9a7d26d36f20c471f73a90a719",
+                "reference": "a9866fd963f53e9a7d26d36f20c471f73a90a719",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.6"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^5.7||^8.5.13"
+            },
+            "type": "library",
+            "autoload": {
+                "files": [
+                    "autoload.php"
+                ],
+                "psr-4": {
+                    "Google\\Service\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "description": "Client library for Google APIs",
+            "homepage": "http://developers.google.com/api-client-library/php",
+            "keywords": [
+                "google"
+            ],
+            "support": {
+                "issues": "https://github.com/googleapis/google-api-php-client-services/issues",
+                "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.238.1"
+            },
+            "time": "2022-03-07T18:23:49+00:00"
+        },
+        {
+            "name": "google/auth",
+            "version": "v1.17.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/googleapis/google-auth-library-php.git",
+                "reference": "4da3a850e9d1045918099b6561165d829efbe2b7"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/4da3a850e9d1045918099b6561165d829efbe2b7",
+                "reference": "4da3a850e9d1045918099b6561165d829efbe2b7",
+                "shasum": ""
+            },
+            "require": {
+                "firebase/php-jwt": "~2.0|~3.0|~4.0|~5.0",
+                "guzzlehttp/guzzle": "^5.3.1|^6.2.1|^7.0",
+                "guzzlehttp/psr7": "^1.2",
+                "php": ">=5.4",
+                "psr/cache": "^1.0|^2.0",
+                "psr/http-message": "^1.0"
+            },
+            "require-dev": {
+                "guzzlehttp/promises": "0.1.1|^1.3",
+                "kelvinmo/simplejwt": "^0.2.5|^0.5.1",
+                "phpseclib/phpseclib": "^2.0.31",
+                "phpunit/phpunit": "^4.8.36|^5.7",
+                "sebastian/comparator": ">=1.2.3"
+            },
+            "suggest": {
+                "phpseclib/phpseclib": "May be used in place of OpenSSL for signing strings or for token management. Please require version ^2."
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "Google\\Auth\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "description": "Google Auth Library for PHP",
+            "homepage": "http://github.com/google/google-auth-library-php",
+            "keywords": [
+                "Authentication",
+                "google",
+                "oauth2"
+            ],
+            "support": {
+                "docs": "https://googleapis.github.io/google-auth-library-php/master/",
+                "issues": "https://github.com/googleapis/google-auth-library-php/issues",
+                "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.17.0"
+            },
+            "time": "2021-08-18T16:10:00+00:00"
+        },
         {
             "name": "guzzlehttp/guzzle",
             "version": "6.5.5",
@@ -1844,6 +2070,123 @@
             ],
             "time": "2020-06-17T14:59:55+00:00"
         },
+        {
+            "name": "paragonie/constant_time_encoding",
+            "version": "v2.5.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/paragonie/constant_time_encoding.git",
+                "reference": "9229e15f2e6ba772f0c55dd6986c563b937170a8"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/9229e15f2e6ba772f0c55dd6986c563b937170a8",
+                "reference": "9229e15f2e6ba772f0c55dd6986c563b937170a8",
+                "shasum": ""
+            },
+            "require": {
+                "php": "^7|^8"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^6|^7|^8|^9",
+                "vimeo/psalm": "^1|^2|^3|^4"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "ParagonIE\\ConstantTime\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Paragon Initiative Enterprises",
+                    "email": "security@paragonie.com",
+                    "homepage": "https://paragonie.com",
+                    "role": "Maintainer"
+                },
+                {
+                    "name": "Steve 'Sc00bz' Thomas",
+                    "email": "steve@tobtu.com",
+                    "homepage": "https://www.tobtu.com",
+                    "role": "Original Developer"
+                }
+            ],
+            "description": "Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)",
+            "keywords": [
+                "base16",
+                "base32",
+                "base32_decode",
+                "base32_encode",
+                "base64",
+                "base64_decode",
+                "base64_encode",
+                "bin2hex",
+                "encoding",
+                "hex",
+                "hex2bin",
+                "rfc4648"
+            ],
+            "support": {
+                "email": "info@paragonie.com",
+                "issues": "https://github.com/paragonie/constant_time_encoding/issues",
+                "source": "https://github.com/paragonie/constant_time_encoding"
+            },
+            "time": "2022-01-17T05:32:27+00:00"
+        },
+        {
+            "name": "paragonie/random_compat",
+            "version": "v9.99.100",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/paragonie/random_compat.git",
+                "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a",
+                "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">= 7"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "4.*|5.*",
+                "vimeo/psalm": "^1"
+            },
+            "suggest": {
+                "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
+            },
+            "type": "library",
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Paragon Initiative Enterprises",
+                    "email": "security@paragonie.com",
+                    "homepage": "https://paragonie.com"
+                }
+            ],
+            "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
+            "keywords": [
+                "csprng",
+                "polyfill",
+                "pseudorandom",
+                "random"
+            ],
+            "support": {
+                "email": "info@paragonie.com",
+                "issues": "https://github.com/paragonie/random_compat/issues",
+                "source": "https://github.com/paragonie/random_compat"
+            },
+            "time": "2020-10-15T08:29:30+00:00"
+        },
         {
             "name": "phenx/php-font-lib",
             "version": "0.5.2",
@@ -1984,6 +2327,117 @@
             ],
             "time": "2020-06-07T10:40:07+00:00"
         },
+        {
+            "name": "phpseclib/phpseclib",
+            "version": "3.0.13",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/phpseclib/phpseclib.git",
+                "reference": "1443ab79364eea48665fa8c09ac67f37d1025f7e"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/1443ab79364eea48665fa8c09ac67f37d1025f7e",
+                "reference": "1443ab79364eea48665fa8c09ac67f37d1025f7e",
+                "shasum": ""
+            },
+            "require": {
+                "paragonie/constant_time_encoding": "^1|^2",
+                "paragonie/random_compat": "^1.4|^2.0|^9.99.99",
+                "php": ">=5.6.1"
+            },
+            "require-dev": {
+                "phing/phing": "~2.7",
+                "phpunit/phpunit": "^5.7|^6.0|^9.4",
+                "squizlabs/php_codesniffer": "~2.0"
+            },
+            "suggest": {
+                "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.",
+                "ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.",
+                "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.",
+                "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations."
+            },
+            "type": "library",
+            "autoload": {
+                "files": [
+                    "phpseclib/bootstrap.php"
+                ],
+                "psr-4": {
+                    "phpseclib3\\": "phpseclib/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Jim Wigginton",
+                    "email": "terrafrost@php.net",
+                    "role": "Lead Developer"
+                },
+                {
+                    "name": "Patrick Monnerat",
+                    "email": "pm@datasphere.ch",
+                    "role": "Developer"
+                },
+                {
+                    "name": "Andreas Fischer",
+                    "email": "bantu@phpbb.com",
+                    "role": "Developer"
+                },
+                {
+                    "name": "Hans-Jürgen Petrich",
+                    "email": "petrich@tronic-media.com",
+                    "role": "Developer"
+                },
+                {
+                    "name": "Graham Campbell",
+                    "email": "graham@alt-three.com",
+                    "role": "Developer"
+                }
+            ],
+            "description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.",
+            "homepage": "http://phpseclib.sourceforge.net",
+            "keywords": [
+                "BigInteger",
+                "aes",
+                "asn.1",
+                "asn1",
+                "blowfish",
+                "crypto",
+                "cryptography",
+                "encryption",
+                "rsa",
+                "security",
+                "sftp",
+                "signature",
+                "signing",
+                "ssh",
+                "twofish",
+                "x.509",
+                "x509"
+            ],
+            "support": {
+                "issues": "https://github.com/phpseclib/phpseclib/issues",
+                "source": "https://github.com/phpseclib/phpseclib/tree/3.0.13"
+            },
+            "funding": [
+                {
+                    "url": "https://github.com/terrafrost",
+                    "type": "github"
+                },
+                {
+                    "url": "https://www.patreon.com/phpseclib",
+                    "type": "patreon"
+                },
+                {
+                    "url": "https://tidelift.com/funding/github/packagist/phpseclib/phpseclib",
+                    "type": "tidelift"
+                }
+            ],
+            "time": "2022-01-30T08:50:05+00:00"
+        },
         {
             "name": "picqer/php-barcode-generator",
             "version": "v2.1.0",
@@ -2060,6 +2514,55 @@
             ],
             "time": "2020-12-24T15:31:19+00:00"
         },
+        {
+            "name": "psr/cache",
+            "version": "1.0.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/php-fig/cache.git",
+                "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8",
+                "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.0"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.0.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Psr\\Cache\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "PHP-FIG",
+                    "homepage": "http://www.php-fig.org/"
+                }
+            ],
+            "description": "Common interface for caching libraries",
+            "keywords": [
+                "cache",
+                "psr",
+                "psr-6"
+            ],
+            "support": {
+                "source": "https://github.com/php-fig/cache/tree/master"
+            },
+            "time": "2016-08-06T20:24:11+00:00"
+        },
         {
             "name": "psr/container",
             "version": "1.0.0",
@@ -2372,6 +2875,70 @@
             ],
             "time": "2020-05-03T19:32:03+00:00"
         },
+        {
+            "name": "pulkitjalan/google-apiclient",
+            "version": "5.0.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/pulkitjalan/google-apiclient.git",
+                "reference": "36b8faabc5cd7de9af4f87cb3457456b031fae3c"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/pulkitjalan/google-apiclient/zipball/36b8faabc5cd7de9af4f87cb3457456b031fae3c",
+                "reference": "36b8faabc5cd7de9af4f87cb3457456b031fae3c",
+                "shasum": ""
+            },
+            "require": {
+                "google/apiclient": "^2.9",
+                "illuminate/support": "^6.0|^7.0|^8.0",
+                "php": "^7.2|^8.0"
+            },
+            "require-dev": {
+                "mockery/mockery": "^1.2.3",
+                "phpunit/phpunit": "^9.3"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "4.1.x-dev"
+                },
+                "laravel": {
+                    "providers": [
+                        "PulkitJalan\\Google\\GoogleServiceProvider"
+                    ],
+                    "aliases": {
+                        "Google": "PulkitJalan\\Google\\Facades\\Google"
+                    }
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "PulkitJalan\\Google\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Pulkit Jalan"
+                }
+            ],
+            "description": "Google api php client wrapper with Cloud Platform and Laravel support",
+            "homepage": "https://github.com/pulkitjalan/google-apiclient",
+            "keywords": [
+                "cloud platform",
+                "google",
+                "laravel"
+            ],
+            "support": {
+                "issues": "https://github.com/pulkitjalan/google-apiclient/issues",
+                "source": "https://github.com/pulkitjalan/google-apiclient/tree/5.0.0"
+            },
+            "time": "2022-02-16T05:35:53+00:00"
+        },
         {
             "name": "ralouphie/getallheaders",
             "version": "3.0.3",
@@ -2554,6 +3121,69 @@
             ],
             "time": "2020-03-29T20:13:32+00:00"
         },
+        {
+            "name": "revolution/laravel-google-sheets",
+            "version": "5.8.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/kawax/laravel-google-sheets.git",
+                "reference": "eb999abcdf01e94f495db1f28666a34f7a1b76bd"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/kawax/laravel-google-sheets/zipball/eb999abcdf01e94f495db1f28666a34f7a1b76bd",
+                "reference": "eb999abcdf01e94f495db1f28666a34f7a1b76bd",
+                "shasum": ""
+            },
+            "require": {
+                "google/apiclient": "^2.10",
+                "illuminate/container": "^6.0||^7.0||^8.0||^9.0",
+                "illuminate/support": "^6.0||^7.0||^8.0||^9.0",
+                "php": "^7.4||^8.0",
+                "pulkitjalan/google-apiclient": "^4.1||^5.0"
+            },
+            "require-dev": {
+                "mockery/mockery": "^1.0",
+                "orchestra/testbench": "^5.0||^6.0||^7.0",
+                "phpunit/phpunit": "^9.0"
+            },
+            "type": "library",
+            "extra": {
+                "laravel": {
+                    "providers": [
+                        "Revolution\\Google\\Sheets\\Providers\\SheetsServiceProvider"
+                    ],
+                    "aliases": {
+                        "Sheets": "Revolution\\Google\\Sheets\\Facades\\Sheets"
+                    }
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Revolution\\Google\\Sheets\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "kawax",
+                    "email": "kawaxbiz@gmail.com"
+                }
+            ],
+            "description": "Google Sheets API v4",
+            "keywords": [
+                "google",
+                "laravel",
+                "sheets"
+            ],
+            "support": {
+                "source": "https://github.com/kawax/laravel-google-sheets/tree/5.8.0"
+            },
+            "time": "2022-02-17T04:38:27+00:00"
+        },
         {
             "name": "sabberworm/php-css-parser",
             "version": "8.3.1",
@@ -6760,5 +7390,5 @@
         "ext-json": "*"
     },
     "platform-dev": [],
-    "plugin-api-version": "1.1.0"
+    "plugin-api-version": "2.0.0"
 }

+ 3 - 0
config/app.php

@@ -140,6 +140,9 @@ return [
 
     'cipher' => 'AES-256-CBC',
 
+    'googleSpreadsheetId' => env('GOOGLE_SPREADSHEET_ID'),
+    'googleSpreadsheetProductsSheetName' => env('GOOGLE_SPREADSHEET_PRODUCTS_SHEET_NAME'),
+
     /*
     |--------------------------------------------------------------------------
     | Autoloaded Service Providers

+ 1 - 1
resources/views/app/admin/bdt_devices_table.blade.php

@@ -1,7 +1,7 @@
 	<table class="table table-striped p-0 m-0 table-sm border-top border-bottom ">
 		<thead class="bg-light">
 			<tr>
-			<th class="border-0">Device Type</th>
+				<th class="border-0">Device Type</th>
 				<th class="border-0">IMEI</th>
 				<th class="border-0">Issued Yet?</th>
 				<th class="border-0">Client</th>

+ 12 - 0
storage/app/.gitignore

@@ -0,0 +1,12 @@
+{
+  "type": "service_account",
+  "project_id": "stag-gsheets",
+  "private_key_id": "d9ead2f78b4bcdb721e07c972a71f752c26e45f5",
+  "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCxLjLfPm7F9B0m\nEkU0l02QLkKMmOIu+ap2xT0LfU4PidXoayHssvLzlOStqRjHaBolfwNOrK+paoix\njhvAIirIojZm4/HmTNhY3TZlb9LpVIXU2mXsN6XZtz+MOPJbd/BPZg9oEZ3T8dbJ\nj9DFph4qTKG6to7EG9vO3FoZqLy+d7lwGoe4XutNmsEv7PH3dIuXnsRWtqHqCKPv\nyLBAcl/ZdFrWpe6AdPvB4bwTa3uW6S2rpOeaodR/nFoKNkoG41Dr75Lh14ONcBXR\n+2FJ6OjxwR7BVVSfIM9R6iNKPh7kiGXBi4QePOkkHT4rjl1zEm+upU6wwQEHridk\nkBWmh4vHAgMBAAECggEAILP+xs7uwlHvCWZo6K6ereSj+vCDGxmRGbAJNvQvctXF\nqksP7XEQP951IQqrnK692LrrYNul5rbXuTIaNCn6TKMIOJCNRy1a53gZQLrVqqSj\nuSiAlIum7JsSuy6NqU1niTg00sghoguq0fReHAUv3y3a0iw9CLx9o15vsPnAsMT4\nLyM1SOffFvbS1409gBxq6zN4Ifjq91JZrjpOHkfNwqFkUmOfvqr4EaviPcZ8vyRc\nDGGz7f6TYqapyVOEcoYmRjSUNQkG7symETndbxssPCIxStzcaNfj0czJf8bgBKlX\n3EnoH+awjuJXe0hpEWnp/aCO68AYq8PEVyMpyMaVIQKBgQDx1iqIRzAi26Z58TKB\nfwcSozbs3q9Vkt6U8dvaJmEjXBXzyFlQ3fg1DkIXXxO+X34+wpo/yvZYCOgN3hLS\n2QZkghDwEvt5SV09L2ycdjmsgWCErohW9PDqxzYxT0v94wDAOU2n0cq546WbKxAZ\nHQclmLlNcFzi2yt+x6lfyjfnJwKBgQC7jqY0HWJLT5kBeQfwC4YYXRS3YwMu6ywy\nLImKx8ateyzW6GBGA1twcAz5Worr9o+dk0MXThkwGi2QTrEH1sZLNNPNYsjznUu0\nLyKkmJWMIgW34WyDTkTqNaKowSF5qFnvCiKoOxM0ioI7Ui9tQj8RKp5QX75xn4Mh\n8XgU6okaYQKBgQC4d4p95P88t5smzOqfiIuWldThnYLUnXEW3925aykRVb6Q87Pd\nUVNw9O1I8ocW4bRknwAVxPVfdXu8iDaHim+r3uKYnYIgo+txLmmEd1HK2e0LiC4L\nVk8mZspZloj6olsCRTOM3SPr40+BKrnezhuTfAlsnlbb3B4zWI1DufYmZQKBgEht\ngclGP5sNlex3rJUKHjJyX3miBqyrrFmD0WmCVDrSAjLLccIXscvtuVThnhwZDsSv\nBY2OXzOwKEA94yc/zTtlnxUFPMy2xXFDcoFVWwrOaJ7lsl3Sb9Jx++pnCmJMnM4u\nf8uvZG85vajix+XNW0Vpy9EF6ClAjAcjlFefamqBAoGBAOF3W+Lb7xTVXXYwjGon\nYB7nXLHDS31PFXhEN9cIuxhKjY++o9pchB7Mwu8ZioQTdw/t8NBK+7+l1lUzo42R\ndbxtXcWyfM1qEIGBKWAEUHytjILUB789W27n9oSNkJKaxgXZxxt0Nao9e1g2rHZp\n8pyUPmI612tRG1ShPQD+IS8V\n-----END PRIVATE KEY-----\n",
+  "client_email": "stag-gsheets@stag-gsheets.iam.gserviceaccount.com",
+  "client_id": "117104359005246095757",
+  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
+  "token_uri": "https://oauth2.googleapis.com/token",
+  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
+  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/stag-gsheets%40stag-gsheets.iam.gserviceaccount.com"
+}

+ 0 - 0
storage/templates/exam-cv-comp/atrial-fibrillation.json