client = new Google($formIntegration); } public static function getValidationRules(): array { return [ ]; } public static function isOAuthRequired(): bool { return true; } public static function getValidationAttributes(): array { return [ 'oauth_id' => 'Google Account', ]; } public function handle(): void { if (!$this->shouldRun()) { return; } Log::debug('Creating Google Spreadsheet record', [ 'spreadsheet_id' => $this->getSpreadsheetId(), 'form_id' => $this->form->id, 'form_slug' => $this->form->slug, ]); $this->client->sheets()->submit($this->submissionData); } protected function getSpreadsheetId(): string { if(!isset($this->integrationData->spreadsheet_id)) { throw new Exception('The spreadsheed is not instantiated'); } return $this->integrationData->spreadsheet_id; } protected function shouldRun(): bool { return parent::shouldRun() && $this->formIntegration->oauth_id && $this->getSpreadsheetId(); } }