/** * Bootstrap any application services. * * @return void */ public function boot() { Spark::details($this->details); Spark::sendSupportEmailsTo($this->sendSupportEmailsTo); if (count($this->developers) > 0) { Spark::developers($this->developers); } if (count($this->roles) > 0) { Spark::useRoles($this->roles); } if ($this->usesTwoFactorAuth) { Spark::useTwoFactorAuth(); } if ($this->usesApi) { Spark::useApi(); } Spark::tokensCan($this->tokensCan); Spark::byDefaultTokensCan($this->byDefaultTokensCan); $this->booted(); if (Spark::billsUsingBraintree()) { $this->configureBraintree(); } }
/** * Get the default JavaScript variables for Spark. * * @return array */ public static function scriptVariables() { return ['braintreeMerchantId' => config('services.braintree.merchant_id'), 'braintreeToken' => Spark::billsUsingBraintree() ? BraintreeClientToken::generate() : null, 'cardUpFront' => Spark::needsCardUpFront(), 'collectsBillingAddress' => Spark::collectsBillingAddress(), 'collectsEuropeanVat' => Spark::collectsEuropeanVat(), 'csrfToken' => csrf_token(), 'currencySymbol' => Cashier::usesCurrencySymbol(), 'env' => config('app.env'), 'roles' => Spark::roles(), 'state' => Spark::call(InitialFrontendState::class . '@forUser', [Auth::user()]), 'stripeKey' => config('services.stripe.key'), 'userId' => Auth::id(), 'usesApi' => Spark::usesApi(), 'usesBraintree' => Spark::billsUsingBraintree(), 'usesTeams' => Spark::usesTeams(), 'usesStripe' => Spark::billsUsingStripe()]; }