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


PHP Role::select方法代码示例

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


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

示例1: search

    public function search()
    {
        $roles = Role::select(array('roles.id', 'roles.name', 'roles.id as users', 'roles.created_at'));
        return Datatables::of($roles)->edit_column('users', '{{{ DB::table(\'assigned_roles\')->where(\'role_id\', \'=\', $id)->count()  }}}')->add_column('actions', '<a href="javascript:void(0)" id="role_edit" role_id="{{{ $id }}}" class="btn_table btn btn-info"><i class="fa fa-share-square-o"></i> Edit</a>
	                             <a href="javascript:void(0)" id="role_delete" role_id="{{{ $id }}}" class="btn_table btn btn-danger"><i class="fa fa-trash-o"></i> Delete</a>
	                ')->remove_column('id')->make();
    }
开发者ID:nelug,项目名称:ControlDePlanilla,代码行数:7,代码来源:RolesController.php

示例2: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     // Title
     $title = Lang::get('admin/roles/title.role_management');
     $roles = Role::select(array('roles.id', 'roles.name', 'roles.id as users', 'roles.created_at'))->get();
     // Show the page
     $this->render('admin.roles/.index', compact('roles', 'title'));
 }
开发者ID:christiannwamba,项目名称:laravel-site,代码行数:13,代码来源:AdminRolesController.php

示例3: run

 public function run()
 {
     DB::table('users')->delete();
     User::create(array('name' => 'Kristijan', 'lozinka' => Hash::make('kristijan'), 'role_id' => Role::select('id')->where('ime', '=', 'Administrator')->first()->id));
     User::create(array('name' => 'Andrija', 'lozinka' => Hash::make('andrija'), 'role_id' => Role::select('id')->where('ime', '=', 'Asistent')->first()->id));
     User::create(array('name' => 'Hrvoje', 'lozinka' => Hash::make('hrvoje'), 'role_id' => Role::select('id')->where('ime', '=', 'Instruktor')->first()->id));
     User::create(array('name' => 'Antun', 'lozinka' => Hash::make('antun'), 'role_id' => Role::select('id')->where('ime', '=', 'Voditelj tečaja')->first()->id));
 }
开发者ID:Firtzberg,项目名称:Edu,代码行数:8,代码来源:UserTableSeeder.php

示例4: tablaRolesPermiso

 public function tablaRolesPermiso()
 {
     $id = Input::get("id");
     $roles = Role::select("id", "name")->orderBy("id")->get();
     $permisos = PermissionRole::where("role_id", "=", $id)->select("id", "state")->orderBy("id")->get();
     $html = View::make("dashboard.roles.rolesTablaPermisos")->with(array("roles" => $roles, "permisos" => $permisos, "role" => Input::get("role"), "id" => $id));
     $datos = (string) $html;
     return Response::json(array("datos" => $datos));
 }
开发者ID:prianticonsulting,项目名称:Habitaria,代码行数:9,代码来源:RolesController.php

示例5: listRole

 public function listRole()
 {
     if (!Request::ajax()) {
         return App::abort(404);
     }
     $start = Input::has('start') ? (int) Input::get('start') : 0;
     $length = Input::has('length') ? Input::get('length') : 10;
     $search = Input::has('search') ? Input::get('search') : [];
     $roles = Role::select('id', 'name');
     if (!empty($search)) {
         foreach ($search as $key => $value) {
             if (empty($value)) {
                 continue;
             }
             $value = ltrim(rtrim($value));
             $roles->where($key, 'like', '%' . $value . '%');
         }
     }
     $order = Input::has('order') ? Input::get('order') : [];
     if (!empty($order)) {
         $columns = Input::has('columns') ? Input::get('columns') : [];
         foreach ($order as $value) {
             $column = $value['column'];
             if (!isset($columns[$column]['name']) || empty($columns[$column]['name'])) {
                 continue;
             }
             $roles->orderBy($columns[$column]['name'], $value['dir'] == 'asc' ? 'asc' : 'desc');
         }
     }
     $count = $roles->count();
     if ($length > 0) {
         $roles = $roles->skip($start)->take($length);
     }
     $arrRoles = $roles->get()->toArray();
     $arrReturn = ['draw' => Input::has('draw') ? Input::get('draw') : 1, 'recordsTotal' => Role::count(), 'recordsFiltered' => $count, 'data' => []];
     if (!empty($arrRoles)) {
         foreach ($arrRoles as $role) {
             $arrReturn['data'][] = array(++$start, $role['id'], $role['name']);
         }
     }
     $response = Response::json($arrReturn);
     $response->header('Content-Type', 'application/json');
     return $response;
 }
开发者ID:nguyendaivu,项目名称:imagestock,代码行数:44,代码来源:RolesController.php

示例6: indexAction

 public function indexAction()
 {
     $request = $this->getRequest();
     $model = new Role();
     $searchForm = new Logic_Role_Form_Filter();
     $this->view->form = $searchForm;
     $filter = $request->getParam('filter_is_deleted', false);
     $ghost = "false";
     if ($filter) {
         $searchForm->getElement('filter_is_active')->setChecked(false);
         $searchForm->getElement('filter_is_deleted')->setChecked(true);
         $ghost = "true";
     }
     $select = $model->select()->from('role')->where('ghost = ' . $ghost);
     $page = $request->getParam('page', 1);
     $sort = $request->getParam('sort', 'id');
     $order = $request->getParam('order', 'asc');
     $select->order($sort . ' ' . $order);
     $paginator = new Base_Paginator(new Zend_Paginator_Adapter_DbTableSelect($select));
     $paginator->setCurrentPageNumber($page);
     $this->view->paginator = $paginator;
     $this->view->headers = array('role_name');
     $this->view->headScript()->appendFile('/static/js/filtr_active.js');
 }
开发者ID:knatorski,项目名称:SMS,代码行数:24,代码来源:RoleController.php

示例7: 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(\'assigned_roles\')->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:binaryk,项目名称:lareab,代码行数:12,代码来源:AdminRolesController.php

示例8: 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', 'roles.updated_at'));
     return Datatables::of($roles)->edit_column('created_at', '{{ $created_at->format("Y-m-d h:i:s") }}')->edit_column('updated_at', '{{ $updated_at->format("Y-m-d h:i:s") }}')->edit_column('users', '<span class="label label-success">{{{ DB::table(\'assigned_roles\')->where(\'role_id\', \'=\', $id)->count()  }}}</span>')->add_column('actions', '
         <div class="btn-group">
         <a href="{{{ URL::to(\'admin/roles/\' . $id . \'/edit\' ) }}}" class="iframe btn btn-xs btn-primary"><i class="fa fa-pencil"></i> {{ Lang::get("button.edit") }}</a>
         @if (!in_array($name, [\'admin\',\'comment\']))
         <a href="{{{ URL::to(\'admin/roles/\' . $id . \'/delete\' ) }}}" class="iframe btn btn-xs btn-danger"><i class="fa fa-trash-o"></i> {{ Lang::get("button.delete") }}</a>
         @endif
         </div>
         ')->remove_column('id')->remove_column('rn')->make();
 }
开发者ID:koanreview,项目名称:laravel-admin-template,代码行数:17,代码来源:AdminRolesController.php

示例9: 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'));
     if (Api::Enabled()) {
         $u = $roles->get();
         return Api::make($u->toArray());
     } else {
         return Datatables::of($roles)->edit_column('users', '{{{ DB::table(\'assigned_roles\')->where(\'role_id\', \'=\', $id)->count()  }}}')->add_column('actions', '<div class="btn-group"><a href="{{{ URL::to(\'admin/roles/\' . $id . \'/edit\' ) }}}" class="modalfy btn btn-sm btn-primary">{{{ Lang::get(\'button.edit\') }}}</a>
                             <a data-row="{{{  $id }}}" data-method="delete" data-table="roles" href="{{{ URL::to(\'admin/roles/\' . $id . \'\' ) }}}" class="ajax-alert-confirm btn btn-sm btn-danger" @if($name == "admin" || $name == "users")disabled@endif>{{{ Lang::get(\'button.delete\') }}}</a></div>
                 ')->make();
     }
 }
开发者ID:Aranjedeath,项目名称:l4-starter,代码行数:17,代码来源:AdminRolesController.php

示例10: showRole

 /**
  * Pobranie danych roli do wyświetlenia
  *
  * @param integer $id id roli
  * @return Row_Rola wiersz z danymi
  */
 public function showRole($id)
 {
     $modelGroup = new Group();
     $select = $modelGroup->select()->from(array('g' => 'group'), array())->joinLeft(array('rg' => 'role_group'), 'rg.id_group = g.id', array())->where('g.ghost = \'f\'')->where('rg.id_role = ?', $id)->columns(array('groups' => new Zend_Db_Expr('array_to_string(array_agg(description),\'<br />\')')))->setIntegrityCheck(false);
     $model = new Role();
     $cols = array('role_name', 'description', 'groups' => new Zend_Db_Expr('(' . $select . ')'), 'ghost' => new Zend_Db_Expr('CASE WHEN ghost=true THEN \'tak\' ELSE \'nie\' END'));
     $select = $model->select()->from(array('r' => 'role'))->columns($cols)->where('r.id = ?', $id);
     $data = $model->fetchRow($select);
     return $data;
 }
开发者ID:knatorski,项目名称:SMS,代码行数:16,代码来源:Privileges.php

示例11: data

 /**
  * Show a list of all the roles formatted for Datatables.
  *
  * @return Datatables JSON
  */
 public function data()
 {
     $roles = Role::select(array('roles.id', 'roles.name', 'roles.description', 'roles.id as users', 'roles.created_at'));
     return Datatables::of($roles)->edit_column('users', '{{{ DB::table(\'assigned_roles\')->where(\'role_id\', \'=\', $id)->count()  }}}')->add_column('actions', '<div class="btn-group">
               <button type="button" class="btn btn-xs btn-primary dropdown-toggle" data-toggle="dropdown">
                 Action <span class="caret"></span>
               </button>
               <ul class="dropdown-menu" role="menu">
                 <li><a href="{{{ URL::to(\'admin/roles/\' . $id ) }}}">{{{ Lang::get(\'button.show\') }}}</a></li>
                 <li><a href="{{{ URL::to(\'admin/roles/\' . $id . \'/edit\' ) }}}">{{{ Lang::get(\'button.edit\') }}}</a></li>
                 @if($name == \'admin\')
                 @else
                 <li><a href="{{{ URL::to(\'admin/roles/\' . $id . \'/delete\' ) }}}">{{{ Lang::get(\'button.delete\') }}}</a></li>
                 @endif
               </ul>
             </div>')->remove_column('id')->make();
 }
开发者ID:ehumps,项目名称:rendezview,代码行数:22,代码来源:AdminRolesController.php

示例12: getDataToUserReport

 public function getDataToUserReport()
 {
     $profileModel = new Profile();
     $select = $profileModel->select()->order('id_user');
     $profileDataArray = $profileModel->fetchAll($select)->toArray();
     $groupModel = new Group();
     $select = $groupModel->select();
     $groupDataArray = $groupModel->fetchAll($select)->toArray();
     foreach ($groupDataArray as $key => $value) {
         $tmp[$value['id']] = $value;
     }
     $groupDataArray = $tmp;
     unset($tmp);
     $branchModel = new Branch();
     $select = $branchModel->select();
     $branchDataArray = $branchModel->fetchAll($select)->toArray();
     foreach ($branchDataArray as $key => $value) {
         $tmp[$value['id']] = $value;
     }
     $branchDataArray = $tmp;
     unset($tmp);
     $userModel = new User();
     $select = $userModel->select();
     $userDataArray = $userModel->fetchAll($select)->toArray();
     foreach ($userDataArray as $key => $value) {
         $tmp[$value['id']] = $value;
     }
     $userDataArray = $tmp;
     unset($tmp);
     $roleModel = new Role();
     $select = $roleModel->select();
     $roleDataArray = $roleModel->fetchAll($select)->toArray();
     foreach ($roleDataArray as $key => $value) {
         $tmp[$value['id']] = $value;
     }
     $roleDataArray = $tmp;
     unset($tmp);
     $groupArray = array();
     foreach ($profileDataArray as $key => $value) {
         $data = $this->getAuthorizationsForProfile($value['id']);
         foreach ($data as $key2 => $values) {
             foreach ($values as $key3 => $privs) {
                 /* if ($privs['ghost'] === true) {
                     unset($data[$key2][$key3]);
                     continue;
                     }
                    */
                 $tmp = array('login' => '', 'surname' => '', 'first_name' => '', 'group' => '', 'role' => '', 'branch' => '', 'ghost' => '');
                 if ($key2 === 'group') {
                     $tmp['group'] = $groupDataArray[$privs['id_group']]['group_name'];
                 }
                 if ($key2 === 'role') {
                     $tmp['role'] = $roleDataArray[$privs['id_role']]['description'];
                 }
                 $tmp['login'] = $userDataArray[$value['id_user']]['login'];
                 $tmp['surname'] = $userDataArray[$value['id_user']]['surname'];
                 $tmp['first_name'] = $userDataArray[$value['id_user']]['first_name'];
                 $tmp['branch'] = $branchDataArray[$value['id_branch']]['branch_name'];
                 $tmp['ghost'] = $userDataArray['ghost'] ? 'NIEAKTYWNY' : 'AKTYWNY';
                 $groupArray[] = $tmp;
             }
         }
     }
     return $groupArray;
 }
开发者ID:knatorski,项目名称:SMS,代码行数:65,代码来源:User.php


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