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


PHP Role::select方法代码示例

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


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

示例1: index

 /**
  * Display a listing of the resource.
  * Display every conversation/topics with the first Thread related
  * @return Response
  */
 public function index(Request $request)
 {
     $Threads = array();
     $Result = array();
     $count = 0;
     $admin = Role::select('id')->where('description', '=', 'admin')->firstorFail();
     // if we are admin we want to see everything
     if (\Auth::id() == $admin->id) {
         $Conversations = User::select('*')->join('conversations', 'conversations.user_id', '=', 'users.id')->get();
     } else {
         // we are not admin but we want to see published messages and the status of our posted messages
         if (\Auth::guest()) {
             $Conversations = User::select('*')->join('conversations', 'conversations.user_id', '=', 'users.id')->where('conversations.Pending', '=', 0)->get();
         } else {
             $Conversations = User::select('*')->join('conversations', 'conversations.user_id', '=', 'users.id')->where('conversations.Pending', '=', 0)->orwhere('conversations.user_id', '=', \Auth::id())->get();
         }
     }
     // we recover the first Thread according to the conversations which passed the previous tests
     foreach ($Conversations as $Conversation) {
         $Threads[$count] = Thread::where('conversation_id', '=', $Conversation->id)->firstOrFail();
         $Result[$count] = array($Conversation, $Threads[$count]);
         $count++;
     }
     return view('dashboard')->with(['dashboard' => $Result, 'adminID' => $admin]);
 }
开发者ID:yves01,项目名称:dashboard,代码行数:30,代码来源:DashboardController.php

示例2: getUsers

 public function getUsers(Request $request)
 {
     $yetkiler = Role::all();
     $count = $request->get('count');
     $page = $request->get('page');
     $filters = $request->get('filter');
     $sorting = $request->get('sorting');
     $results = new User();
     if (is_array($filters)) {
         foreach ($filters as $key => $filter) {
             $results = $results->where($key, 'like', "%" . urldecode($filter) . "%");
         }
     }
     if (is_array($sorting)) {
         foreach ($sorting as $key => $sort) {
             $results = $results->orderBy($key, $sort);
         }
     } else {
         $results = $results->orderBy('id', 'desc');
     }
     if ($request->has('count') && $request->has('page')) {
         $results = $results->skip($count * ($page - 1))->take($count);
     }
     $results = $results->get();
     $filter_yetkiler = Role::select('id', 'display_name as title')->get();
     return array('results' => $results, 'inlineCount' => User::count(), 'yetkiler' => $yetkiler, 'filter_yetkiler' => $filter_yetkiler);
 }
开发者ID:tanmuhittin,项目名称:rolemanager,代码行数:27,代码来源:RoleController.php

示例3: isAdmin

 /**
  * Compare the role_id of the user with the admin role id of the database
  * return true if user is Admin
  */
 public function isAdmin()
 {
     $adminID = Role::select('id')->where('description', '=', 'admin')->firstOrFail();
     if ($this->role_id == $adminID->id) {
         return true;
     }
     return false;
 }
开发者ID:yves01,项目名称:dashboard,代码行数:12,代码来源:User.php

示例4: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  *
  * @return void
  */
 public function edit($id)
 {
     $roles = Role::select('id', 'name', 'label')->get();
     $user = User::with('roles')->select('id', 'name', 'email')->findOrFail($id);
     $user_roles = [];
     foreach ($user->roles as $role) {
         $user_roles[] = $role->name;
     }
     return view('admin.users.edit', compact('user', 'roles', 'user_roles'));
 }
开发者ID:appzcoder,项目名称:laravel-admin,代码行数:17,代码来源:UsersController.php

示例5: getBoardsWithPermissions

 /**
  * Returns board uris with this permission.
  *
  * @param  \App\Contracts\PermissionUser|null  $user  User roles must belong to. Defaults to null.
  * @param  bool  $anonymous  Determines if we should allow generic, unassigned roles. Defaults true.
  * @return Collection  of \App\Board->board_uri strings
  */
 public function getBoardsWithPermissions(PermissionUser $user = null, $anonymous = true)
 {
     // Identify roles which affect this user.
     // Sometimes we will only want direct assignments.
     // This includes null user_id assignments for anonymouse users.
     $userRoles = UserRole::select('role_id')->where(function ($query) use($user, $anonymous) {
         if ($anonymous) {
             $query->whereNull('user_id');
         }
         if ($user instanceof PermissionUser && !$user->isAnonymous()) {
             $query->orWhere('user_id', $user->user_id);
         } else {
             if (!$anonymous) {
                 $query->where(\DB::raw('0'), '1');
             }
         }
     })->get()->pluck('role_id');
     if (!$userRoles) {
         return collect();
     }
     $inheritRoles = Role::select('role_id', 'inherit_id')->whereIn('role_id', $userRoles)->get()->pluck('inherit_id')->filter(function ($item) {
         return !is_null($item);
     });
     // Identify roles which use this permission,
     // or which borrow inherited roles.
     $validRoles = RolePermission::select('role_id', 'permission_id')->where(function ($query) use($userRoles, $inheritRoles) {
         $query->orWhereIn('role_id', $userRoles);
         if ($inheritRoles) {
             $query->orWhereIn('role_id', $inheritRoles);
         }
     })->where('permission_id', $this->permission_id)->get()->pluck('role_id');
     if (!$validRoles) {
         return collect();
     }
     // Find the intersection of roles we have and roles we want.
     $intersectIdents = collect($userRoles)->intersect(collect($validRoles));
     $inheritIdents = collect($inheritRoles)->intersect(collect($validRoles));
     $intersectRoles = collect();
     if ($intersectIdents) {
         // These are only roles which are directly assigned to us with
         // this permission.
         $intersectRoles = collect(Role::select('role_id', 'board_uri')->whereIn('role_id', $intersectIdents)->get()->pluck('board_uri'));
     }
     if ($inheritIdents) {
         $intersectRoles = collect(Role::select('role_id', 'board_uri')->whereIn('inherit_id', $inheritIdents)->whereIn('role_id', $userRoles)->get()->pluck('board_uri'))->merge($intersectRoles);
     }
     return $intersectRoles;
 }
开发者ID:LulzNews,项目名称:infinity-next,代码行数:55,代码来源:Permission.php

示例6: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id which is the id of the conversation
  * @return Response
  */
 public function show($id)
 {
     $admin = Role::select('id')->where('description', '=', 'admin')->firstOrFail();
     // if we are admin we want to see everything
     if (\Auth::id() == $admin->id) {
         $listofMessages = User::select("*")->Join('threads', 'threads.user_id', '=', 'users.id')->where("threads.conversation_id", '=', $id)->get();
     } else {
         // we are not admin but we want to see published messages and the status of our posted messages
         if (\Auth::guest()) {
             $listofMessages = User::select("*")->Join('threads', 'threads.user_id', '=', 'users.id')->where("threads.conversation_id", '=', $id)->where('threads.Pending', '=', 0)->get();
         } else {
             $listofMessages = User::select("*")->Join('threads', 'threads.user_id', '=', 'users.id')->where("threads.conversation_id", '=', $id)->where('threads.Pending', '=', 0)->orwhere('threads.user_id', '=', \Auth::id())->get();
         }
     }
     // We want the list of message related to this conversation with their writers
     //$listofMessages= Thread::select("*")->Join('users', 'Threads.user_id', '=', 'users.id')->where("threads.conversation_id",'=',$id)->get();
     return view('Thread')->with(['lstOfMessages' => $listofMessages, 'adminID' => $admin]);
 }
开发者ID:yves01,项目名称:dashboard,代码行数:24,代码来源:ThreadController.php

示例7: index

 /**
  * Display a listing of the resource.
  *
  * @param  Request  $request
  * @return Datatables
  */
 public function index(Request $request)
 {
     $roles = Role::select(['id', 'name', 'slug', 'created_at']);
     // roles visibility
     if (!Sentinel::getUser()->is_super_admin) {
         $roles->whereNotIn('slug', config('laravel-user-module.non_visibility.role_slugs'));
     }
     // if is filter action
     if ($request->has('action') && $request->input('action') === 'filter') {
         $roles->filter($request);
     }
     $addColumns = ['addUrls' => $this->urls];
     $editColumns = ['name' => function ($model) {
         return $model->name_uc_first;
     }, 'created_at' => function ($model) {
         return $model->created_at_table;
     }];
     $removeColumns = [];
     return $this->getDatatables($roles, $addColumns, $editColumns, $removeColumns);
 }
开发者ID:erenmustafaozdal,项目名称:laravel-user-module,代码行数:26,代码来源:RoleApiController.php

示例8: getGiveRolePermissions

 /**
  * Display given permissions to role.
  *
  * @return void
  */
 public function getGiveRolePermissions()
 {
     $roles = Role::select('id', 'name', 'label')->get();
     $permissions = Permission::select('id', 'name', 'label')->get();
     return view('admin.permissions.role-give-permissions', compact('roles', 'permissions'));
 }
开发者ID:appzcoder,项目名称:laravel-admin,代码行数:11,代码来源:AdminController.php

示例9: data

 /**
  * Show a list of all the languages posts formatted for Datatables.
  *
  * @return Datatables JSON
  */
 public function data()
 {
     $roles = Role::select(array('roles.id', 'roles.name', 'roles.created_at'));
     return Datatables::of($roles)->add_column('actions', '<a href="{{{ URL::to(\'admin/roles/\' . $id . \'/edit\' ) }}}" class="btn btn-success btn-sm iframe" ><span class="glyphicon glyphicon-pencil"></span>  {{ Lang::get("admin/modal.edit") }}</a>
                 <a href="{{{ URL::to(\'admin/roles/\' . $id . \'/delete\' ) }}}" class="btn btn-sm btn-danger iframe"><span class="glyphicon glyphicon-trash"></span> {{ Lang::get("admin/modal.delete") }}</a>
             ')->remove_column('id')->make();
 }
开发者ID:ryleto,项目名称:nightjar,代码行数:12,代码来源:RoleController.php

示例10: getData

 /**
  * Show a list of all the roles formatted for Datatables.
  *
  * @return Datatables JSON
  */
 public function getData()
 {
     $roles = Role::select(array('roles.id', 'roles.name', 'roles.id as users', 'roles.created_at'));
     return Datatables::of($roles)->edit_column('users', '{{{ DB::table(\'role_user\')->where(\'role_id\', \'=\', $id)->count()  }}}')->add_column('actions', '<a href="{{{ URL::to(\'admin/roles/\' . $id . \'/edit\' ) }}}" class="iframe btn btn-xs btn-default">{{{ Lang::get(\'button.edit\') }}}</a>
                             <a href="{{{ URL::to(\'admin/roles/\' . $id . \'/delete\' ) }}}" class="iframe btn btn-xs btn-danger">{{{ Lang::get(\'button.delete\') }}}</a>
                 ')->remove_column('id')->make();
 }
开发者ID:fetch404,项目名称:fetch404,代码行数:12,代码来源:AdminRolesController.php

示例11: destroy

 public function destroy(Request $request, $id)
 {
     $version = Episodever::select('user_id')->where('episode_id', $id)->where('first', 1)->first();
     if ($version->user_id != $request->user()->id) {
         return '抱歉, 目前仅支持添加此条目的用户删除分集> <';
     }
     $favorite = Epfav::select('user_id')->where('episode_id', $id)->first();
     if ($favorite) {
         return '抱歉, 已有人收藏本集,不能删除> <';
     }
     $review = Review::select('id')->where('episode_id', $id)->first();
     if ($review) {
         return '抱歉,已有人评论本集,不能删除> <';
     }
     $role = Role::select('id')->where('episode_id', $id)->first();
     if ($role) {
         return '抱歉,请先逐一删除SC关联后再删除本集';
     }
     $item = Item::select('id')->where('episode_id', $id)->first();
     if ($item) {
         return '抱歉,已有剧单收录本集,不能删除> <';
     }
     $ed = Ed::select('id')->where('episode_id', $id)->first();
     if ($ed) {
         return '抱歉,请先逐一删除歌曲关联后再删除本集';
     }
     $episode = Episode::find($id, ['id', 'drama_id']);
     if ($episode->delete()) {
         DB::table('users')->where('id', $version->user_id)->decrement('episodevers');
         return redirect()->route('drama.show', [$episode->drama_id]);
     } else {
         return '删除失败';
     }
 }
开发者ID:suowei,项目名称:saoju,代码行数:34,代码来源:EpisodeController.php

示例12: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $user = User::findOrFail($id);
     $roles = Role::select('id', 'name')->lists('name', 'id');
     return view('user.edit', compact('user', 'roles'));
 }
开发者ID:renciebautista,项目名称:perfectstore,代码行数:12,代码来源:UserController.php

示例13: getUserRolePermissions

 /**
  * Display given permissions to role.
  *
  * @return void
  */
 public function getUserRolePermissions()
 {
     $roles = Role::select('id', 'name', 'label')->get();
     $permissions = Permission::select('id', 'name', 'label')->get();
     return \View::make('admin.permissions.role-assign-permissions', ['roles' => $roles, 'permissions' => $permissions, 'title' => 'assign']);
 }
开发者ID:meccado,项目名称:acl-admin-control-panel,代码行数:11,代码来源:AdminController.php

示例14: query

 /**
  * Get the query object to be processed by dataTables.
  *
  * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder|\Illuminate\Support\Collection
  */
 public function query()
 {
     $query = Role::select('*');
     return $this->applyScopes($query);
 }
开发者ID:adit33,项目名称:inventory,代码行数:10,代码来源:RoleDataTable.php


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