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


PHP Role::destroy方法代码示例

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


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

示例1: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param int $id
  *
  * @return mixed
  */
 public function destroy($id)
 {
     $canBeDeleted = empty(Role::find($id)->available_appointment->toArray());
     if ($canBeDeleted) {
         Role::destroy($id);
         \Flash::success('Role deleted!');
     } else {
         \Flash::error('Cannot delete because they are existing appointments for this role.');
     }
     return redirect('admin/data-management/roles');
 }
开发者ID:troccoli,项目名称:lva,代码行数:18,代码来源:RolesController.php

示例2: getDelete

 public function getDelete($id)
 {
     Role::destroy($id);
     return redirect()->back();
 }
开发者ID:hilmysyarif,项目名称:laravel-starter,代码行数:5,代码来源:RoleController.php

示例3: destroyRole

 /**
  * Locate role, detach from perms and users then delete.
  *
  * @param $name
  */
 protected static function destroyRole($name)
 {
     $roleActiveDirectoryInspector = Role::where('name', $name)->first();
     if ($roleActiveDirectoryInspector) {
         $roleActiveDirectoryInspector->perms()->detach();
         $roleActiveDirectoryInspector->users()->detach();
         Role::destroy($roleActiveDirectoryInspector->id);
     }
 }
开发者ID:sroutier,项目名称:l51esk-modules,代码行数:14,代码来源:MaintenanceTrait.php

示例4: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     if ($result = check_auth_to('JSLB_DELETE')) {
         return $result;
     }
     try {
         Role::destroy($id);
         return redirect()->action('Admin\\RoleController@index')->with('operationstatus', 'sucess');
     } catch (\Exception $e) {
         return redirect()->back()->withErrors(['error' => '删除角色失败,请重试(' . $e->getMessage() . ')']);
     }
 }
开发者ID:xinzou,项目名称:authority_management,代码行数:18,代码来源:RoleController.php

示例5: delete

 /**
  * Elimina un rol especifico
  *
  * @param  int  $id
  * @return Response
  */
 public function delete($id)
 {
     $data["id"] = $id;
     $validator = Validator::make($data, ['id' => 'integer']);
     if ($validator->fails()) {
         return response()->json(["msg" => "alert", "validator" => $validator->messages()], 200);
     }
     if ($role = Role::destroy($id)) {
         return response()->json(["msg" => "Success"], 200);
     } else {
         return response()->json(["msg" => "error", "description" => "No se ha encontrado el rol"], 200);
     }
 }
开发者ID:whoOami,项目名称:potential-smd,代码行数:19,代码来源:RoleController.php

示例6: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Role::destroy($id);
     $code = 200;
     $msg = json_encode(array('msg' => $code));
     return $msg;
 }
开发者ID:nosun,项目名称:laravel_base,代码行数:13,代码来源:RoleController.php

示例7: destroyRole

 public function destroyRole($id)
 {
     $result = Role::destroy($id);
     return $result;
 }
开发者ID:jaumesala,项目名称:opendata-maps,代码行数:5,代码来源:RoleRepository.php


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