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


PHP Role::whereIn方法代碼示例

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


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

示例1: deleteEventRoles

 public static function deleteEventRoles($eventIdList)
 {
     if (!is_array($eventIdList)) {
         $eventIdList = [$eventIdList];
     }
     $rnames = [];
     foreach ($eventIdList as $e) {
         $rnames = array_merge($rnames, PermissionNames::AllEventPermissions($e));
         $rnames[] = RoleNames::EventManager($e);
     }
     Role::whereIn('name', $rnames)->delete();
 }
開發者ID:a161527,項目名稱:cs319-p2t5,代碼行數:12,代碼來源:RoleCreate.php

示例2: doAccountRoleChange

 private function doAccountRoleChange($roleNames, $alterUsing)
 {
     $roles = Role::whereIn("name", $roleNames)->get();
     if (count($roles) != sizeof($roleNames)) {
         return false;
     }
     $alterUsing($roles);
     return true;
 }
開發者ID:a161527,項目名稱:cs319-p2t5,代碼行數:9,代碼來源:PermissionsController.php

示例3: down

 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Permission::whereIn('name', ['view.admin', 'update.application'])->delete();
     Role::whereIn('name', ['administrator', 'manager'])->delete();
 }
開發者ID:fluentkit,項目名稱:fluentkit,代碼行數:10,代碼來源:2016_01_22_141553_create_base_roles_and_permissions.php

示例4: edit

 /**
  * Permite crear un registro de usuario
  *
  * @param  Request $request
  * @param  integer $id
  * @return Response View
  */
 public function edit(Request $request, $id = 0)
 {
     $usuario = Usuario::find($id);
     $roles = Role::whereIn('id', [1, 2]);
     return view('super.usuarios.edit')->withUsuario($usuario)->withRoles($roles);
 }
開發者ID:egalink,項目名稱:fastener,代碼行數:13,代碼來源:UsuariosController.php

示例5: putRolesUpdate

 public function putRolesUpdate($id, Request $request)
 {
     $user = $this->repo->findOrFail($id);
     $this->validate($request, ['roles' => 'array']);
     // fetch an id list array of the permissions we need
     $roles = Role::whereIn('name', $request->get('roles', []))->get();
     $ids = [];
     foreach ($roles as $role) {
         $ids[] = $role->id;
     }
     // sync to current user
     $user->roles()->sync($ids);
     return response()->json(['status' => 'success', 'message' => trans('api.resource_updated', ['resource' => trans('global.user')])])->setStatusCode(200);
 }
開發者ID:fluentkit,項目名稱:fluentkit,代碼行數:14,代碼來源:UsersController.php

示例6: CrudCoach

 public function CrudCoach()
 {
     $activo = array(1 => 'Si', 0 => 'No');
     $edit = DataEdit::source(new User());
     $edit->add('name', 'Nombre', 'text')->rule('required');
     $edit->add('last_name', 'Apellidos', 'text')->rule('required');
     $edit->add('email', 'Email', 'text')->rule('required');
     $edit->add('cuenta_activa', 'Activo', 'select')->options($activo);
     $edit->add('roles', 'Roles', 'checkboxgroup')->options(Role::whereIn('id', [2, 5])->lists('display_name', 'id'));
     $edit->add('imagen_perfil', 'Imagen', 'image')->rule('mimes:jpeg,png')->move('uploads/users_images/');
     $edit->add('rut', 'Rut', 'text')->rule('required');
     return $edit->view('coach.crud', compact('edit'));
 }
開發者ID:davila7,項目名稱:kayra,代碼行數:13,代碼來源:UsuariosController.php


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