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


PHP Role::delete方法代码示例

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


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

示例1: delete

 /**
  * Delete role
  * 
  * @param Role $role
  * @return \Illiminate\Http\RedirectResponse
  */
 public function delete(Role $role)
 {
     if ($role->id !== 1) {
         $role->delete();
     }
     return redirect('admin/roles/list');
 }
开发者ID:dookda,项目名称:mapigniter2,代码行数:13,代码来源:RoleController.php

示例2: destroy

 public function destroy($id)
 {
     $user = Role::delete($id);
     $user->delete();
     foreach ($user->roles() as $u) {
         $user->roles()->detach($u->id);
     }
 }
开发者ID:nutsdo,项目名称:mz-service,代码行数:8,代码来源:RoleController.php

示例3: destroy

 public function destroy(Role $role)
 {
     if (!Helper::getMode()) {
         return redirect()->back()->withErrors(config('constants.DISABLE_MESSAGE'));
     }
     if ($role->name == 'admin') {
         return redirect('/configuration#permission')->withErrors(config('constants.INVALID_LINK'));
     }
     $role->delete();
     return redirect()->back()->withSuccess(config('constants.DELETED'));
 }
开发者ID:EneaWeb,项目名称:aliangel,代码行数:11,代码来源:RoleController.php

示例4: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(Role $role)
 {
     // Set role to null for each user
     foreach ($role->users as $user) {
         $user->role_id = null;
         $user->save();
     }
     //destroy the role
     $role->delete();
     return redirect()->route('admin.roles.index')->withWarning("The Role {$role->role} has been removed!");
 }
开发者ID:Yismen,项目名称:solpieles,代码行数:17,代码来源:RolesController.php

示例5: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(Role $role)
 {
     $role->delete();
     return redirect('/admin/role')->with('flash_success', 'Роль успешно удалена.');
 }
开发者ID:Ravend6,项目名称:laravel_base_v5.2,代码行数:11,代码来源:RoleController.php

示例6: destroy

 /**
  * Delete a role
  */
 public function destroy(Role $role)
 {
     logThis('Role ' . $role->label . ' deleted');
     $role->delete();
 }
开发者ID:goatatwork,项目名称:access2,代码行数:8,代码来源:RolesApiController.php

示例7: delete_user_role

 private function delete_user_role(User $user, Role $role)
 {
     //Remove all permissions then delete the user and the roles
     $role->perms()->sync(array());
     $user->delete();
     $role->delete();
 }
开发者ID:brucewu16899,项目名称:WebPanel-Core,代码行数:7,代码来源:PermissionsTest.php

示例8: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(Role $role)
 {
     $role->delete();
     return redirect()->action('RolesController@index');
 }
开发者ID:jimmylorunning,项目名称:librapp,代码行数:11,代码来源:RolesController.php

示例9: apiRoleDelete

 /**
  * API for deleting a role
  */
 public function apiRoleDelete(Role $role)
 {
     $role->delete();
 }
开发者ID:goatatwork,项目名称:goatshark,代码行数:7,代码来源:UsersController.php

示例10: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  App\Role $role
  * @return Response
  */
 public function destroy($role)
 {
     $role->delete();
     return redirect()->route('webpanel.store.roles.index');
 }
开发者ID:brucewu16899,项目名称:WebPanel-Core,代码行数:11,代码来源:RolesController.php


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