當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。