hasClient($data['Client Name'])) { throw new ImportException('Client already exists'); } $transformed = [ 'company_id' => $this->company->id, 'name' => $this->getString($data, 'Client Name'), 'phone' => $this->getString($data, 'Phone'), 'country_id' => isset($data['Country']) ? $this->getCountryIdBy2($data['Country']) : null, 'credit_balance' => 0, 'settings' => new \stdClass, 'client_hash' => Str::random(40), 'contacts' => [ [ 'email' => $this->getString($data, 'Email'), 'phone' => $this->getString($data, 'Phone'), ], ], ]; return $transformed; } }