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