当前位置: 首页>>代码示例>>PHP>>正文


PHP Group::all方法代码示例

本文整理汇总了PHP中app\models\Group::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Group::all方法的具体用法?PHP Group::all怎么用?PHP Group::all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Group的用法示例。


在下文中一共展示了Group::all方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit(User $User)
 {
     $this->data['Roles'] = Role::all();
     $this->data['Groups'] = Group::all();
     $this->data['User'] = $User;
     return view('admin.users.edit', $this->data);
 }
开发者ID:DJZT,项目名称:tezter,代码行数:13,代码来源:UsersController.php

示例2: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $data['groups'] = Group::all();
     $data['createbtn'] = Permission::hasPermission('groups.create');
     $data['editbtn'] = Permission::hasPermission('groups.edit');
     $data['deletebtn'] = Permission::hasPermission('groups.delete');
     return view('groups.index', $data);
 }
开发者ID:mahitiinfo,项目名称:rubanbridge,代码行数:13,代码来源:GroupController.php

示例3: load

 private function load(Request $request, &$data, $params)
 {
     $columnsInfo = ['name' => ['alias' => 'نام', 'class' => \App\User::class], 'email' => ['alias' => 'ایمیل', 'class' => \App\User::class], 'group_id' => ['alias' => 'گروه کاربری', 'class' => \App\Models\Group::class, 'wherethrough' => ['key' => 'alias', 'value' => 'id']]];
     $data['user']['info'] = Filter::Rendering(\App\User::class, $columnsInfo, $params['search'], $params['perPage']);
     //        \Symfony\Component\VarDumper\VarDumper::dump($data['user']['info']);
     $data['user']['load'] = \App\Models\Group::all();
     $data['params'] = $params;
     $this->init_data($request, $data);
 }
开发者ID:vakili722,项目名称:GreenWork,代码行数:9,代码来源:UserController.php

示例4: create

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create($society)
 {
     if (Helpers::perm('admin', $society) or Helpers::perm('edit', $society)) {
         $data['society'] = $society;
         $data['groups'] = Group::all();
         return View::make('rosters.create', $data);
     } else {
         return view('shared.unauthorised');
     }
 }
开发者ID:bishopm,项目名称:circuit,代码行数:15,代码来源:RostersController.php

示例5: getVerify

 public function getVerify()
 {
     $this->beforeFilter('admin');
     $status = Input::get('status');
     if ($status) {
         $groups = Group::where('status', '=', $status)->get();
     } else {
         $groups = Group::all();
     }
     return Response::json($groups);
 }
开发者ID:st421,项目名称:madison,代码行数:11,代码来源:GroupsApiController.php

示例6: getUserWithPermission

 /**
  * Return a user with specified permission
  *
  * @return \___PHPSTORM_HELPERS\static|mixed
  */
 protected function getUserWithPermission($permission = 'admin')
 {
     $user = App\User::find(46);
     $groups = App\Models\Group::all();
     foreach ($groups as $group) {
         if ($group->hasPermission($permission)) {
             $user = App\User::fromGroup($group)->first();
         }
     }
     return $user;
 }
开发者ID:buys-fran,项目名称:mtech-mis,代码行数:16,代码来源:MisAcceptanceTestCase.php

示例7: groupList

 public function groupList()
 {
     return Group::all();
 }
开发者ID:arjayads,项目名称:green-tracker,代码行数:4,代码来源:GroupController.php

示例8: index

 /**
  * Show the specified photo comment.
  *
  * @param  int  $photoId
  * @param  int  $commentId
  * @return Response
  */
 public function index()
 {
     return Group::all()->toArray();
 }
开发者ID:Zlob,项目名称:SkillCompass,代码行数:11,代码来源:GroupController.php

示例9: index

 /**
  * Show all groups
  *
  * @return $this
  */
 public function index()
 {
     $this->authorize('view_users');
     return view('users.groups.index')->with('groups', Group::all());
 }
开发者ID:buys-fran,项目名称:mtech-mis,代码行数:10,代码来源:GroupsController.php

示例10: test_group_index_view_shows

 /**
  * A basic test example.
  *
  * @return void
  */
 public function test_group_index_view_shows()
 {
     $this->visit('group')->see('MTech MIS Login Screen');
     $user = \App\User::find(46);
     $this->actingAs($user)->visit('group')->see('User Groups Management')->assertViewHas('groups', Group::all());
 }
开发者ID:buys-fran,项目名称:mtech-mis,代码行数:11,代码来源:GroupsControllerTest.php

示例11: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $this->data['Groups'] = Group::all();
     return view('admin.groups.list', $this->data);
 }
开发者ID:DJZT,项目名称:tezter,代码行数:10,代码来源:GroupsController.php

示例12: foreach

 function double_linux_names()
 {
     /* For all groups.. */
     foreach (Group::all() as $group) {
         $linux_names = [];
         foreach ($group->students as $student) {
             if (!in_array($student->user->linux_name, $linux_names)) {
                 $linux_names[] = $student->user->linux_name;
             } else {
                 echo "Group " . $group->name . " has multiple users with name " . $student->user->linux_name . ".\n";
             }
         }
     }
 }
开发者ID:robindv,项目名称:WebDB,代码行数:14,代码来源:Tools.php

示例13: edit

 /**
  * Show edit for for the specified permission
  *
  * @param Permission $permission
  * @return $this
  */
 public function edit(Permission $permission)
 {
     $this->authorize('edit_users');
     return view('users.permissions.edit')->with(['permission' => $permission, 'groups' => Group::all()]);
 }
开发者ID:buys-fran,项目名称:mtech-mis,代码行数:11,代码来源:PermissionsController.php

示例14: edit

 /**
  * 修改管理员信息
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit(Request $request, $id)
 {
     //
     $oAdmin = Admin::findOrFail($id);
     $aGroups = Admin::get_groups($id);
     // get method
     if ($request->isMethod('get')) {
         $oAllGroup = Group::all();
         return view('admin.manager.edit', ['admin' => $oAdmin, 'belongs' => $aGroups, 'all_groups' => $oAllGroup]);
     }
     // post method
     // inputs
     $username = trim($request->input('username'));
     $password = trim($request->input('password'));
     $email = $request->input('email');
     $groups = $request->input('groups');
     $groups = empty($groups) ? array() : array_filter(array_unique($groups));
     $oCurrentAdmin = Admin::findOrFail(session('admin_id'));
     $aCurrentGroups = Admin::get_groups(session('admin_id'));
     if (in_array(1, $aGroups) && !in_array(1, $aCurrentGroups)) {
         // 用户拥有超级管理员权限,而自己没有
         session()->flash('msg_error', '修改失败:对方属于超级管理员组');
         return back();
     }
     if (Admin::is_last_superadmin($id) && !in_array(1, $groups)) {
         // 用户已经是最后一个超级管理员时无法移除
         array_unshift($groups, 1);
         session()->flash('msg_error', '已经是最后一个超级管理员,无法从超级管理员组中移除');
         return back();
     }
     //
     $validate = $this->edit_validator(['username' => $username, 'password' => $password, 'email' => $email]);
     if ($validate->fails()) {
         session()->flash('msg_error', '输入格式不正确');
         return back();
     }
     if ($oAdmin->username != $username && Admin::exists_username($username)) {
         session()->flash('msg_error', '此用户名已存在');
         return back();
     }
     /**
      * 处理修改用户所属的组
      */
     $aAllGroups = Group::select(['id'])->get()->toArray();
     $aAllGroups = array_column($aAllGroups, 'id');
     $temp_length = count($groups);
     for ($i = 0; $i < $temp_length; $i++) {
         $groups[$i] = intval($groups[$i]);
         if (!in_array($groups[$i], $aAllGroups)) {
             // 数据库中不存在该组
             unset($groups[$i]);
             continue;
         }
         if (!(in_array(1, $aCurrentGroups) || in_array($groups[$i], $aCurrentGroups))) {
             // 无法给予自己也没有的权限组,除非自己属于超级管理员组
             unset($groups[$i]);
             session()->flash('msg_error', '抱歉,部分组添加失败.首先你要是该组组员');
             continue;
         }
     }
     $oAdmin->username = $username;
     $oAdmin->email = $email;
     if ($password) {
         $oAdmin->password = password_encrypt($password);
     }
     $oAdmin->save();
     Admin::update_groups($groups, $id);
     session()->flash('msg_success', '修改成功');
     return back();
 }
开发者ID:smartgirl001,项目名称:Test,代码行数:76,代码来源:AdminController.php


注:本文中的app\models\Group::all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。