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


PHP Board::canEditConfig方法代碼示例

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


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

示例1: putAdd

 /**
  * Adds new staff.
  *
  * @return Response
  */
 public function putAdd(Board $board)
 {
     if (!$board->canEditConfig($this->user)) {
         return abort(403);
     }
     $createUser = false;
     $roles = $this->user->getAssignableRoles($board);
     $rules = [];
     $existing = Input::get('staff-source') == "existing";
     if ($existing) {
         $rules = ['existinguser' => ["required", "string", "exists:users,username"], 'captcha' => ["required", "captcha"]];
         $input = Input::only('existinguser', 'captcha');
         $validator = Validator::make($input, $rules);
     } else {
         $createUser = true;
         $validator = $this->registrationValidator();
     }
     $castes = $roles->pluck('role_id');
     $casteRules = ['castes' => ["required", "array"]];
     $casteInput = Input::only('castes');
     $casteValidator = Validator::make($casteInput, $casteRules);
     $casteValidator->each('castes', ["in:" . $castes->implode(",")]);
     if ($validator->fails()) {
         return redirect()->back()->withInput()->withErrors($validator->errors());
     } else {
         if ($casteValidator->fails()) {
             return redirect()->back()->withInput()->withErrors($casteValidator->errors());
         } else {
             if ($createUser) {
                 $user = $this->registrar->create(Input::all());
             } else {
                 $user = User::whereUsername(Input::only('existinguser'))->firstOrFail();
             }
         }
     }
     $user->roles()->detach($roles->pluck('role_id')->toArray());
     $user->roles()->attach($casteInput['castes']);
     Event::fire(new UserRolesModified($user));
     return redirect("/cp/board/{$board->board_uri}/staff");
 }
開發者ID:LulzNews,項目名稱:infinity-next,代碼行數:45,代碼來源:StaffController.php

示例2: getStaff

 /**
  * List all staff members to the user.
  *
  * @return Response
  */
 public function getStaff(Board $board)
 {
     if (!$board->canEditConfig($this->user)) {
         return abort(403);
     }
     $roles = $board->roles;
     $staff = $board->getStaff();
     return $this->view(static::VIEW_STAFF, ['board' => $board, 'roles' => $roles, 'staff' => $staff, 'tab' => "staff"]);
 }
開發者ID:nitogel,項目名稱:infinity-next,代碼行數:14,代碼來源:ConfigController.php

示例3: putTags

 /**
  * Put tags.
  *
  * @return Response
  */
 public function putTags(Board $board)
 {
     if (!$board->canEditConfig($this->user)) {
         return abort(403);
     }
     $input = Input::all();
     $rules = ['boardTags' => ["array", "min:0", "max:5"]];
     if (isset($input['boardTags']) && is_array($input['boardTags'])) {
         $input['boardTags'] = array_filter($input['boardTags']);
     }
     $validator = Validator::make($input, $rules);
     $validator->each('boardTags', ['string', 'alpha_dash', 'max:24']);
     if (!$validator->passes()) {
         return redirect()->back()->withErrors($validator->errors());
     }
     $tags = [];
     $tagArray = [];
     foreach ($input['boardTags'] as $boardTag) {
         $boardTag = (string) $boardTag;
         if (strlen($boardTag) && !isset($tagArray[$boardTag])) {
             // Add the tag to the list of set tags to prevent duplicates.
             $tagArray[$boardTag] = true;
             // Find or create the board tag.
             $tags[] = BoardTag::firstorCreate(['tag' => $boardTag]);
         }
     }
     $board->tags()->detach();
     if (count($tags)) {
         $tags = $board->tags()->saveMany($tags);
     }
     Event::fire(new BoardWasModified($board));
     return $this->view(static::VIEW_TAGS, ['board' => $board, 'tags' => array_keys($tagArray), 'tab' => "tags"]);
 }
開發者ID:JEWSbreaking8chan,項目名稱:infinity-next,代碼行數:38,代碼來源:ConfigController.php

示例4: authorize

 /**
  * Determines if the client has access to this form.
  *
  * @return boolean
  */
 public function authorize()
 {
     return $this->board->canEditConfig($this->user);
 }
開發者ID:LulzNews,項目名稱:infinity-next,代碼行數:9,代碼來源:BoardConfigRequest.php

示例5: getConfig

 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function getConfig(Request $request, Board $board)
 {
     if (!$board->canEditConfig($this->user)) {
         return abort(403);
     }
     $optionGroups = OptionGroup::getBoardConfig($board);
     return $this->view(static::VIEW_CONFIG, ['board' => $board, 'groups' => $optionGroups, 'tab' => "basic"]);
 }
開發者ID:spanishtech,項目名稱:infinity-next,代碼行數:13,代碼來源:ConfigController.php


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