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


PHP Role::find方法代码示例

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


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

示例1: edit

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

示例2: deleteRole

 public function deleteRole()
 {
     $id = \Input::get('id');
     $role = Role::find($id);
     $retData['status'] = $role->delete() ? 200 : 500;
     return \Response::json($retData);
 }
开发者ID:sujithma,项目名称:AccountsTransaction,代码行数:7,代码来源:RolesController.php

示例3: revokePermission

 public function revokePermission($id, $permission_id)
 {
     $role = Role::find($id);
     $permission = Permission::find($permission_id);
     $role->revokePermission($permission);
     return redirect()->back();
 }
开发者ID:phelipperibeiro,项目名称:book_store_laravel,代码行数:7,代码来源:RolesController.php

示例4: checklogin

 public function checklogin(Request $request)
 {
     //print_r($request->all());
     $name = $request->get('name');
     $code = $request->get('code');
     $password = $request->input('password');
     if ($code == session('captcha')) {
         //$manager = \DB::table('managers')->select('name','password','status')->where('name','=',$name)->get();
         $manager = Models\Manager::select('id', 'role_id', 'name', 'password', 'status')->where('name', '=', $name)->first();
         if (count($manager) == 1) {
             if ($manager->status == 1) {
                 if ($manager->password == md5(md5($password))) {
                     session(array('adminid' => $manager->id, 'adminname' => $manager->name));
                     //获取当前角色拥有的权限并存入session
                     $role = Models\Role::find($manager->role_id);
                     $authAllows = array();
                     foreach ($role->auths as $v) {
                         $authAllows[] = $v['module_name'] . '.' . $v['controller_name'] . '.' . $v['action_name'];
                     }
                     session(array('authAllows' => $authAllows));
                     return redirect(action('Admin\\IndexController@index'));
                 } else {
                     return $this->loginRedirectTo('账号密码错误');
                 }
             } else {
                 return $this->loginRedirectTo('账号未激活');
             }
         } else {
             return $this->loginRedirectTo('用户不存在');
         }
     } else {
         return $this->loginRedirectTo('验证码不正确');
     }
 }
开发者ID:honxin,项目名称:studentclub,代码行数:34,代码来源:LogController.php

示例5: update

 public function update($role_id, $name)
 {
     $role = Role::find($role_id);
     $role->name = $name;
     $role->save();
     return $role;
 }
开发者ID:lufias,项目名称:L5admin,代码行数:7,代码来源:RoleRepository.php

示例6: delete

 public function delete($id)
 {
     /* @var Role $role */
     $role = Role::find($id);
     $role->delete();
     return $role;
 }
开发者ID:clubttt,项目名称:SuccessModel4,代码行数:7,代码来源:RoleService.php

示例7: getEdit

 public function getEdit($id)
 {
     $this->redirectIfCant('edit', '');
     $role = Role::find($id);
     $menus = Menu::ofParent(null)->sort()->get();
     $this->setSubtitle('Detail - ' . $role->display_label);
     return $this->render('backend.pages.security.roles.form', compact('menus', 'role'));
 }
开发者ID:miarizkim,项目名称:simonev,代码行数:8,代码来源:RoleController.php

示例8: save_per_role

 public function save_per_role()
 {
     $role = Input::get('role');
     $prmission = Input::get('permission');
     $rolesP = Role::find(Input::get('role'));
     $rolesP->attachPermission(Input::get('permission'));
     //return view('assign_per_role');
     return redirect()->route('assign_per_role');
 }
开发者ID:sushilcs111,项目名称:sourcesunlimited,代码行数:9,代码来源:PermissionsController.php

示例9: brokers

 public function brokers()
 {
     $category = Role::find(Config::get('constants.ROLE_BROKER'));
     $results = Article::where('category_id', '=', $category->id)->paginate(18);
     if (Request::ajax()) {
         return Response::json(View::make('articles.category')->withResults($results)->render());
     }
     return View::make('articles.category')->withCategory($category)->withArticles($results);
 }
开发者ID:remix101,项目名称:compex,代码行数:9,代码来源:ArticlesController.php

示例10: getAllRoles

 public function getAllRoles()
 {
     $allRolesobj = Role::find()->select(['RoleId', 'RoleName'])->where(['status' => 'Active'])->all();
     $data = ArrayHelper::toArray($allRolesobj, ['RoleId', 'RoleName']);
     $roleIdCol = array_column($data, 'RoleId');
     $RoleNameCol = array_column($data, 'RoleName');
     $RolesData = array_combine($roleIdCol, $RoleNameCol);
     return $RolesData;
 }
开发者ID:ewwgit,项目名称:eptri,代码行数:9,代码来源:AdminMaster.php

示例11: IndexAdmin

 public function IndexAdmin()
 {
     $opex = Opex::whereYear('fecha', '=', date('Y'))->selectRaw('sum(monto) as monto, fecha as mes')->groupBy(\DB::raw('MONTH(fecha)'))->get();
     $alumnos_activos = Role::find(1)->users()->where('cuenta_activa', true)->count();
     $alumnos_totales = Role::find(1)->users()->count();
     $coachs = Role::find(2)->users()->where('cuenta_activa', true)->count();
     $pagos = PagoMensualidad::whereYear('fecha_pago', '=', date('Y'))->selectRaw('sum(monto) as monto, fecha_pago as mes')->groupBy(\DB::raw('MONTH(fecha_pago)'))->get();
     return view('admin_home', compact('opex', 'alumnos_activos', 'alumnos_totales', 'pagos', 'coachs'));
 }
开发者ID:davila7,项目名称:kayra,代码行数:9,代码来源:HomeController.php

示例12: rolesArrayBuilder

 public static function rolesArrayBuilder()
 {
     $roles = Role::find()->all();
     $rolesIndex = [];
     foreach ($roles as $id => $role) {
         $rolesIndex[$role->role] = $id + 1;
     }
     return $rolesIndex;
 }
开发者ID:NightWatch-BG,项目名称:sglobka,代码行数:9,代码来源:Role.php

示例13: usersByRole

 /**
  * List all users
  *
  * @return response
  */
 public function usersByRole($role_id)
 {
     $role = Role::find($role_id);
     if ($role === null) {
         throw new NotFoundHttpException();
     }
     $users = User::where('role_id', $role_id)->paginate(config('back.default_pagination'));
     return view('backend::user.index', ['users' => $users, 'avatar_path' => config('back.avatar_path')]);
 }
开发者ID:vuongabc92,项目名称:ot,代码行数:14,代码来源:UserController.php

示例14: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $role = Role::find($id);
     if ($role) {
         return response()->json(["data" => $role, "result" => "success"], 200);
     } else {
         return response()->json(["result" => "error"], 200);
     }
 }
开发者ID:kiril-malyhin,项目名称:Wish-List,代码行数:15,代码来源:RoleController.php

示例15: delete

 /**
  * Delete role
  *
  * @param int $id            
  * @throws SaveException
  */
 public function delete($id)
 {
     try {
         $role = RoleModel::find($id);
         $role->delete();
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:jasekz,项目名称:filament-for-laravel-5,代码行数:15,代码来源:Role.php


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