Ejemplo n.º 1
0
 /**
  * Get all of the available roles that may be assigned to team members.
  *
  * @return \Illuminate\Http\Response
  */
 public function getTeamRoles()
 {
     $roles = [];
     foreach (Spark::roles() as $key => $value) {
         $roles[] = ['value' => $key, 'text' => $value];
     }
     return response()->json($roles);
 }
 /**
  * Customize the roles that may be assigned to team members.
  *
  * @return void
  */
 protected function customizeRoles()
 {
     Spark::defaultRole('member');
     Spark::roles(['admin' => 'Administrator', 'member' => 'Member']);
 }
 /**
  * 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()];
 }
Ejemplo n.º 4
0
 /**
  * Validate a team update request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return void
  */
 protected function validateTeamMemberUpdate(Request $request, $team, $user)
 {
     if (Spark::$validateTeamMemberUpdatesWith) {
         $this->callCustomValidator(Spark::$validateTeamMemberUpdatesWith, $request, [$team, $user]);
     } else {
         $availableRoles = implode(',', array_except(array_keys(Spark::roles()), 'owner'));
         $this->validate($request, ['role' => 'required|in:' . $availableRoles]);
     }
 }
Ejemplo n.º 5
0
 /**
  * {@inheritdoc}
  */
 public function validator($team, $member, array $data)
 {
     return Validator::make($data, ['role' => 'required|in:' . implode(',', array_keys(Spark::roles()))]);
 }