Disconnects a network account from user.

@param integer $id

@return \yii\web\Response
@throws \yii\web\NotFoundHttpException
@throws \yii\web\ForbiddenHttpException
773377
public function actionDisconnect($id)
    {
        $account = Social::find()->byId($id)->one();
        if ($account === null) {
            throw new NotFoundHttpException();
        }
        if ($account->user_id != Yii::$app->user->id) {
            throw new ForbiddenHttpException();
        }
        $account->delete();
        return $this->redirect(['networks']);
    }
25256
public function disConnect(string $id, string $container, bool $force = false)
    {
        $data = [
            'force' => $force,
            'container' => $container,
        ];

        $url = self::$base_url.'/'.$id.'/disconnect';

        $request = json_encode($data);

        return self::$curl->post($url, $request);
    }
608181
public function actionDelete($id)
{
try {
$this->findModel($id)->delete();
} catch (\Exception $e) {
$msg = (isset($e->errorInfo[2]))?$e->errorInfo[2]:$e->getMessage();
\Yii::$app->getSession()->addFlash('error', $msg);
return $this->redirect(Url::previous());
}

// TODO: improve detection
$isPivot = strstr('$id',',');
if ($isPivot == true) {
return $this->redirect(Url::previous());
} elseif (isset(\Yii::$app->session['__crudReturnUrl']) && \Yii::$app->session['__crudReturnUrl'] != '/') {
Url::remember(null);
$url = \Yii::$app->session['__crudReturnUrl'];
\Yii::$app->session['__crudReturnUrl'] = null;

return $this->redirect($url);
} else {
return $this->redirect(['index']);
}
}
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')]));
    }
324547
public function delete($id = null)
    {
        $user = $this->Users->get($id);
        $this->request->allowMethod(['post', 'delete']);

        if ($this->Users->delete($user)) {
            $this->Flash->success(__('The user has been deleted.'));
        } else {
            $this->Flash->error(__('The user could not be deleted. Please, try again.'));
        }

        return $this->redirect(['action' => 'index']);
    }
1077829
public function actionStop($id)
    {
        if (!$this->module->canWorkerStop) {
            throw new ForbiddenHttpException(Module::t('notice', 'Stop is forbidden.'));
        }

        $record = $this->findRecord($id);
        $record->stop();
        return $this
            ->success(Module::t('notice', 'The worker will be stopped within {timeout} sec.', [
                'timeout' => $record->pinged_at + $this->env->workerPingInterval - time(),
            ]))
            ->redirect(['index']);
    }
880816
public function actionBan($id = null)
    {
        $model = User::find()->where(['id' => $id])->limit(1)->one();
        if (empty($model)) {
            $this->error(Yii::t('podium/flash', 'Sorry! We can not find Member with this ID.'));
            return $this->redirect(['admin/members']);
        }
        if ($model->id == User::loggedId()) {
            $this->error(Yii::t('podium/flash', 'Sorry! You can not ban or unban your own account.'));
            return $this->redirect(['admin/members']);
        }
        if ($model->status == User::STATUS_ACTIVE) {
            if ($model->ban()) {
                $this->module->podiumCache->delete('members.fieldlist');
                Log::info('User banned', $model->id, __METHOD__);
                $this->success(Yii::t('podium/flash', 'User has been banned.'));
            } else {
                Log::error('Error while banning user', $model->id, __METHOD__);
                $this->error(Yii::t('podium/flash', 'Sorry! There was some error while banning the user.'));
            }
            return $this->redirect(['admin/members']);
        }
        if ($model->status == User::STATUS_BANNED) {
            if ($model->unban()) {
                $this->module->podiumCache->delete('members.fieldlist');
                Log::info('User unbanned', $model->id, __METHOD__);
                $this->success(Yii::t('podium/flash', 'User has been unbanned.'));
            } else {
                Log::error('Error while unbanning user', $model->id, __METHOD__);
                $this->error(Yii::t('podium/flash', 'Sorry! There was some error while unbanning the user.'));
            }
            return $this->redirect(['admin/members']);
        }
        $this->error(Yii::t('podium/flash', 'Sorry! User has got the wrong status.'));
        return $this->redirect(['admin/members']);
    }
1225853
public function actionDelete($id)
    {
        if (\Yii::$app->user->can('delete')) {
            $model = $this->findModel($id);
            foreach($model->files as $file)
                $file->delete();

            $model->delete();

            return $this->redirect(['index']);
        } else
            throw new ForbiddenHttpException(Module::t('core', 'Access denied.'));
    }
999254
public function destroy($id)
    {
        try {
            $this->repository->delete($id);

            return $this->redirect('categories.index');
        } catch (ModelNotFoundException $e) {
            return $this->redirectNotFound();
        }
    }
579124
public function deleteAction($id)
    {
        $id = $this->getRequest()->get($this->admin->getIdParameter());
        $object = $this->admin->getObject($id);

        if (!$object) {
            throw new NotFoundHttpException(sprintf('unable to find the object with id : %s', $id));
        }

        if (false === $this->admin->isGranted('DELETE', $object)) {
            throw new AccessDeniedException();
        }
        /** @var Request $request */
        $request = $this->get('request_stack')->getCurrentRequest();
        if ($request->getMethod() == 'DELETE') {
            try {
                $this->admin->delete($object);
                $this->get('session')->getFlashBag()->add('sonata_flash_success', 'flash_delete_success');
            } catch (ModelManagerException $e) {
                $this->get('session')->getFlashBag()->add('sonata_flash_error', 'flash_delete_error');
            }

            return new RedirectResponse($this->admin->generateUrl(
                'list',
                ['active_tab' => $this->getRequest()->get('context')]
            ));
        }

        return $this->render(
            $this->admin->getTemplate('delete'),
            [
                'object' => $object,
                'action' => 'delete',
            ]
        );
    }
923190
public function actionDelete($id)
    {
        if (!\Yii::$app->user->can('delete'))
            throw new ForbiddenHttpException(\Module::t('metaTag', 'Access denied.'));
        parent::actionDelete($id);
    }
769811
public function actionDelete($id)
    {
        $request = \Yii::$app->request;
        if ($request->getIsOptions()) {
            return $this->ResponseOptions($this->verbs()['delete']);
        }
        $this->findModel($id)->delete();
        Helper::invalidate();

        return ["success"=> true];
    }
806405
public function actionDelete($id)
    {
        if (Yii::$app->request->isPost) {
            $this->findModel($id)->delete();
        }
        return $this->redirect(['index']);
    }
812947
public function destroy($id)
    {
        $user = UserRepository::find($id);
        $this->checkUser($user);

        $email = $user->getLogin();

        try {
            $user->delete();
        } catch (\Exception $e) {
            return Redirect::route('users.show', ['users' => $id])
                ->with('error', 'We were unable to delete the account.');
        }

        $mail = [
            'url'     => URL::to(Config::get('credentials.home', '/')),
            'email'   => $email,
            'subject' => Config::get('app.name').' - Account Deleted Notification',
        ];

        Mail::queue('credentials::emails.admindeleted', $mail, function ($message) use ($mail) {
            $message->to($mail['email'])->subject($mail['subject']);
        });

        return Redirect::route('users.index')
            ->with('success', 'The user has been deleted successfully.');
    }
847361
public function actionDelete($id)
    {
        if (!\Yii::$app->user->can('delete'))
            throw new ForbiddenHttpException(Module::t('core', 'Access denied.'));

        if($id == 1)
            \Yii::$app->session->setFlash(
                'warning',
                \Yii::t('core', 'Node can not be deleted.')
            );
        else {
            $node = $this->findModel($id);
            // find all node childrens
            $childrens = $node->children()->all();
            $node->deleteWithChildren();
            // update deleted rubrics to 1 in all posts with rubrics are $id or $childrens ID
            $ids = $id;
            foreach($childrens as $node)
                $ids .= ',' . $node->id;
            Post::updateAll(['rubric' => 1], 'rubric IN (' . $ids . ')');
        }

        return $this->redirect(['index']);
    }
24707
public function actionDelete($id)
    {
        if (($model = PaymentMethod::findOne($id)) !== null) {
            $model->delete();
            return $this->redirect(['index']);
        } else {
            throw new NotFoundHttpException('The requested page does not exist.');
        }
    }
401518
public function actionDelete($id)
    {
        if (Yii::$app->request->isAjax) {
            try {
                $this->service->remove($id);
                $this->output['status'] = 1;
            } catch (YiiException $e) {
                $this->output['errors'] = (array) $e->data;
            }
        }
    }