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


PHP Permission::name方法代碼示例

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


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

示例1: edit

 public function edit($id)
 {
     $permission = Permission::name('Faxbox\\Repositories\\Phone\\PhoneInterface', 'view', $id);
     $groups = $this->groups->allWithChecked($permission);
     $phone = $this->phones->byId($id);
     $this->view('phones.edit', compact('phone', 'groups'));
 }
開發者ID:jeanfrancis,項目名稱:faxbox,代碼行數:7,代碼來源:PhoneController.php

示例2: register

 /**
  * Registers a new permission with the system directly in the database.
  * @param  Permission $perm
  * @return boolean    Whether the permission was successfully added.
  */
 public static function register($perm)
 {
     $db =& self::$db;
     $db->pushState()->select('sys_perms')->fields('name, display, description, type')->append($perm->name(), $perm->display(), $perm->description(), $perm->type());
     $result = $db->found();
     $db->popState();
     if (!$result) {
         logMsg('Permissions: failed to register a new permission', 3, 5);
     }
     return $result;
 }
開發者ID:Zyr93,項目名稱:DiamondMVC,代碼行數:16,代碼來源:class_permissions.php

示例3: update

 public function update($data)
 {
     $phone = $this->phones->findOrFail($data['id']);
     $phone->fill($data);
     $permission = \Permission::name('Faxbox\\Repositories\\Phone\\PhoneInterface', 'view', $data['id']);
     if (isset($data['groups'])) {
         foreach ($data['groups'] as $id => $access) {
             $group = $this->groups->byId($id);
             $group->permissions = [$permission => $access];
             $group->save();
         }
     }
     if ($phone->save()) {
         $result['success'] = true;
         $result['message'] = trans('phones.updated');
     } else {
         $result['success'] = false;
         $result['message'] = trans('phones.updateproblem');
     }
     return $result;
 }
開發者ID:jeanfrancis,項目名稱:faxbox,代碼行數:21,代碼來源:EloquentPhoneRepository.php

示例4: compact

             $send = !$fax['sent'];
             break;
         case 'never':
             break;
     }
     $template = $fax['sent'] ? 'emails.fax.sent.success' : 'emails.fax.sent.failed';
     if ($send) {
         Mail::send($template, compact('fax'), function ($message) use($fax) {
             $status = $fax['sent'] ? 'successfully sent' : 'sending failed';
             $message->to($fax['user']['email'])->subject('Fax ' . $status);
         });
     }
 }
 if ($fax['direction'] == 'received') {
     $phoneViewer = Permission::name('Faxbox\\Repositories\\Phone\\PhoneInterface', 'view', $fax['phone']['id']);
     $phoneAdmin = Permission::name('Faxbox\\Repositories\\Phone\\PhoneInterface', 'admin', $fax['phone']['id']);
     $users = Sentry::findAllUsersWithAccess([$phoneViewer, $phoneAdmin]);
     foreach ($users as $user) {
         $send = false;
         switch ($user->received_notification) {
             case 'always':
                 $send = true;
                 break;
             case 'mine':
                 $send = $user->hasAccess($phoneAdmin);
                 break;
             case 'groups':
                 // todo check groups
                 break;
             case 'never':
                 break;
開發者ID:jeanfrancis,項目名稱:faxbox,代碼行數:31,代碼來源:observables.php


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