Destroy given admin.

@param \Cortex\Auth\Models\Admin $admin

@throws \Exception

@return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
190623
public function destroy(Admin $admin)
    {
        $admin->delete();

        return intend([
            'url' => route('adminarea.admins.index'),
            'with' => ['warning' => trans('cortex/foundation::messages.resource_deleted', ['resource' => trans('cortex/auth::common.admin'), 'identifier' => $admin->username])],
        ]);
    }
773158
public function actionDelete($id)
    {
        if (Admin::find()->count() == 1) {
            Yii::$app->getSession()->setFlash('success', Yii::t('yuncms', 'This is the last administrator, delete can not manage the system, it can not be deleted!'));
            return $this->redirect(['index']);
        }
        $this->findModel($id)->delete();
        Yii::$app->getSession()->setFlash('success', Yii::t('yuncms', 'Delete success.'));
        return $this->redirect(['index']);
    }
962429
public function destroy($id)
    {
     	$user_setting = User_setting::findOrfail($id);
     	$user_setting->delete();
        return URL::to('user_setting');
    }
615881
def destroy
      @post = Post.find(params[:id])
      @post.destroy

      redirect_to admin_trash_path, notice: I18n.t("controllers.admin.trash.destroy.flash.success")
    end
538189
public function destroy($id)
    {
        try {
            $this->content->destroy($id);
        } catch (Exception $e) {
            return $this->handleException($e, trans('soda::errors.delete', ['object' => trans('soda::terminology.content')]));
        }

        return redirect()->back()->with('info', trans('soda::messages.deleted', ['object' => trans('soda::terminology.content')]));
    }
585632
public function delete(Redirect $redirect)
    {
        $endpoint = '/admin/redirect/'.$redirect->id.'.json';
        $response = $this->request($endpoint, 'DELETE');
        return;
    }
181842
public function destroy(Role $role)
    {
        $role->permissions()->detach();
        $role->admins()->detach();
        $role->delete();

        return response()->json(['status' => 1, 'message' => '成功']);
    }
21854
public function destroy($id)
    {
        $this->entriesRepository->delete($id, $this->resource);

        return response()->json(['status' => 'ok']);
    }
924621
def destroy
      post = Blogo::Post.where(permalink: params[:id]).first!
      Blogo::DestroyPostService.new(post).destroy!

      flash[:notice] = I18n.translate('blogo.admin.post_removed')
      redirect_to blogo_admin_posts_path
    end
212738
public function destroy(Storage $storage)
    {
        $this->storage->destroy($storage);

        return redirect()->route('admin.product.storage.index')
            ->withSuccess(trans('core::core.messages.resource deleted', ['name' => trans('product::storages.title.storages')]));
    }
743033
public function destroy($id)
    {
    	$role = Role::findOrFail($id);
		$role->delete();
		
		return redirect(url("role"))->with('dp_announce', trans('deeppermission.alert.role.deleted'));
    }
976638
public function delete(): void
    {
        if (!userHasPermission('admin:auth:accounts:delete')) {
            unauthorised();
        }

        // --------------------------------------------------------------------------

        //  Get the user's details
        $oUri       = Factory::service('Uri');
        $oInput     = Factory::service('Input');
        $oSession   = Factory::service('Session', 'nails/module-auth');
        $oUserModel = Factory::model('User', 'nails/module-auth');
        $iUserId    = $oUri->segment(5);
        $oUser      = $oUserModel->getById($iUserId);

        // --------------------------------------------------------------------------

        //  Non-superusers editing superusers is not cool
        if (!isSuperuser() && userHasPermission('superuser', $oUser)) {
            $oSession->setFlashData('error', lang('accounts_edit_error_noteditable'));
            $this->returnToIndex();
        }

        // --------------------------------------------------------------------------

        //  Delete user
        $oUser = $oUserModel->getById($iUserId);

        if (!$oUser) {
            show404();
        } elseif ($oUser->id == activeUser('id')) {
            $oSession->setFlashData('error', lang('accounts_delete_error_selfie'));
            $this->returnToIndex();
        }

        // --------------------------------------------------------------------------

        //  Define messages
        if ($oUserModel->destroy($iUserId)) {

            $sStatus  = 'success';
            $sMessage = lang('accounts_delete_success', title_case($oUser->first_name . ' ' . $oUser->last_name));

            //  Update admin changelog
            $this->oChangeLogModel->add(
                'deleted',
                'a',
                'user',
                $iUserId,
                '#' . number_format($iUserId) . ' ' . $oUser->first_name . ' ' . $oUser->last_name
            );

        } else {
            $sStatus  = 'error';
            $sMessage = lang('accounts_delete_error', title_case($oUser->first_name . ' ' . $oUser->last_name));
        }

        $oSession->setFlashData($sStatus, $sMessage);

        // --------------------------------------------------------------------------

        $this->returnToIndex();
    }
38380
public function destroy($id)
    {
        $this->model = $this->model->findOrFail($id);

        $this->runChecks('destroy', $this->model->toArray());

        return $this->model->delete();
    }
598631
public function destroy($id)
    {
        $result = $this->service->destroy($id);

        if ($result) {
            return redirect('admin/features')->with('message', 'Successfully deleted');
        }

        return redirect('admin/features')->with('errors', ['Failed to delete']);
    }
808467
public function destroy($id)
    {
        try {
            $this->contentTypes->destroy($id);
        } catch (Exception $e) {
            return $this->handleException($e, trans('soda::errors.delete', ['object' => trans('soda::terminology.content_type')]));
        }

        return redirect()->route('soda.content-types.index')->with('warning', trans('soda::messages.deleted', ['object' => trans('soda::terminology.content_type')]));
    }
1248762
public function destroy($id)
    {
        $deleted = $this->repository->delete($id);

        if (request()->wantsJson()) {
            return response()->json([
                'message' => 'Attendance deleted.',
                'deleted' => $deleted,
            ]);
        }

        return redirect()->back()->with('message', 'Attendance deleted.');
    }
807747
public function destroy($id = null)
    {
        // ID has to be defined
        if (!isset($id)) {
            throw new \InvalidArgumentException('Undefined ID to destroy', 400);
        }

        // Perform before hook
        $this->beforeDestroy($id);

        // Update the model
        $result = $this->db()->table($this->table)->where($this->primaryKey, $id)->limit(1)->delete();

        // Return false on failures
        if (!$result) {
            throw new \Exception('Could not destroy the model', 500);
        }

        // Perform after hook
        $this->afterDestroy($id);

        // Return the destroyed model ID, or false on fail
        return $id;
    }