當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Spark::defaultRole方法代碼示例

本文整理匯總了PHP中Laravel\Spark\Spark::defaultRole方法的典型用法代碼示例。如果您正苦於以下問題:PHP Spark::defaultRole方法的具體用法?PHP Spark::defaultRole怎麽用?PHP Spark::defaultRole使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Laravel\Spark\Spark的用法示例。


在下文中一共展示了Spark::defaultRole方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: attachUserToTeamByInvitation

 /**
  * Attach a user to a given team based on their invitation.
  *
  * @param  string  $invitationId
  * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
  * @return void
  */
 public function attachUserToTeamByInvitation($invitationId, $user)
 {
     $userModel = get_class($user);
     $inviteModel = get_class((new $userModel())->invitations()->getQuery()->getModel());
     $invitation = (new $inviteModel())->where('token', $invitationId)->first();
     if ($invitation) {
         $invitation->team->users()->attach([$user->id], ['role' => Spark::defaultRole()]);
         $user->switchToTeam($invitation->team);
         $invitation->delete();
     }
 }
開發者ID:ronlobo,項目名稱:spark,代碼行數:18,代碼來源:TeamRepository.php

示例2: customizeRoles

 /**
  * Customize the roles that may be assigned to team members.
  *
  * @return void
  */
 protected function customizeRoles()
 {
     Spark::defaultRole('member');
     Spark::roles(['admin' => 'Administrator', 'member' => 'Member']);
 }
開發者ID:rrrhys,項目名稱:spark-inventory,代碼行數:10,代碼來源:SparkServiceProvider.php

示例3: joinTeamById

 /**
  * Join the team with the given ID.
  *
  * @param  int  $teamId
  * @return void
  */
 public function joinTeamById($teamId)
 {
     $this->teams()->attach([$teamId], ['role' => Spark::defaultRole()]);
     $this->currentTeam();
     event(new JoinedTeam($this, $this->teams()->find($teamId)));
 }
開發者ID:nsoimaru,項目名稱:spark,代碼行數:12,代碼來源:CanJoinTeams.php

示例4: joinTeamById

 /**
  * Join the team with the given ID.
  *
  * @param  int  $teamId
  * @return void
  */
 public function joinTeamById($teamId)
 {
     $this->teams()->attach([$teamId], ['role' => Spark::defaultRole()]);
     $this->currentTeam();
 }
開發者ID:ronlobo,項目名稱:spark,代碼行數:11,代碼來源:CanJoinTeams.php

示例5: handle

 /**
  * {@inheritdoc}
  */
 public function handle($team, $user, $role = null)
 {
     $team->users()->attach($user, ['role' => $role ?: Spark::defaultRole()]);
     event(new TeamMemberAdded($team, $user));
 }
開發者ID:defenestrator,項目名稱:groid,代碼行數:8,代碼來源:AddTeamMember.php


注:本文中的Laravel\Spark\Spark::defaultRole方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。