@param $id

@return array

@throws \yii\base\InvalidConfigException
491439
public function exportById($id): array
    {
        $categoryGroup = Craft::$app->categories->getGroupById((int) $id);

        return $this->export($categoryGroup);
    }
96040
public function actionDelete($id)
    {
        Yii::$app->response->format = Response::FORMAT_JSON;
        $routes = $this->module->routes;

        $model = Mediafile::findOne($id);

        if ($model->isImage()) {
            $model->deleteThumbs($routes);
        }

        $model->deleteFile($routes);
        $model->delete();

        return ['success' => 'true'];
    }
678818
public function exportById($id): array
    {
        $site = Craft::$app->sites->getSiteById((int) $id);

        return $this->export($site);
    }
588210
public function run($id)
    {
        $model = $this->getModel($id);
        $model->setScenario($this->scenario);
        if ($model->load(Yii::$app->getRequest()->post())) {
            if (Yii::$app->getRequest()->isAjax) {
                Yii::$app->getResponse()->format = Response::FORMAT_JSON;
                return ActiveForm::validate($model);
            }
            if ($model->save()) {
                $this->addSuccessFlash();
                return $this->redirect($model);
            } else {
                $this->addErrorFlash();
            }
        }

        return $this->controller->render($this->view, [
            $this->nameVariableModel => $model,
        ]);
    }
654225
private function getProfile($id) {
		if(!$this->profiles->has($id)) {
			throw new InvalidConfigException('Profile for encrypt "' . $id . '" not configured!');
		}
		/** @var Encrypter $encrypter */
		$encrypter = $this->profiles->get($id);
		return $encrypter;
	}
538117
public function actionView($id)
    {
        $model = $this->findModel($id);
        $providerTerm = new \yii\data\ArrayDataProvider([
            'allModels' => $model->terms,
        ]);

        return $this->render('view', [
            'model'        => $this->findModel($id),
            'providerTerm' => $providerTerm,
        ]);
    }
736690
public function actionAssign(string $id)
    {
        $items = Yii::$app->getRequest()->post('items', []);
        $model = $this->findModel($id);
        $model->addChildren($items);

        return array_merge($model->getItems());
    }
1207017
public function actionView($id)
    {
        $model = $this->findModel($id);
        $providerBlock = new \yii\data\ArrayDataProvider([
            'allModels' => $model->blocks,
        ]);
        $providerComment = new \yii\data\ArrayDataProvider([
            'allModels' => $model->comments,
        ]);
        $providerPost = new \yii\data\ArrayDataProvider([
            'allModels' => $model->posts,
        ]);
        $providerProduct = new \yii\data\ArrayDataProvider([
            'allModels' => $model->products,
        ]);
        $providerTerm = new \yii\data\ArrayDataProvider([
            'allModels' => $model->terms,
        ]);
        return $this->render('view', [
            'model' => $this->findModel($id),
            'providerBlock' => $providerBlock,
            'providerComment' => $providerComment,
            'providerPost' => $providerPost,
            'providerProduct' => $providerProduct,
            'providerTerm' => $providerTerm,
        ]);
    }
1261019
public function getGist(string $id): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/gists/:id', $id));
    }
1288946
public function actionUpdate($id)
    {
        $model = $this->findModel($id);
        $oldSubmodulesParentUid = $model->parent_uid . '/{' . $model->id . '}';

        $post = Yii::$app->request->post();
        $loaded = $model->load($post);
        if ($loaded && $model->save()) {
            $newSubmodulesParentUid = $model->parent_uid . '/{' . $model->id . '}';
            $model->correctParents($oldSubmodulesParentUid, $newSubmodulesParentUid);

            //return $this->redirect(['view', 'id' => $model->id]);
            return $this->redirect(['index', 'id' => $model->id]);
        } else {
            return $this->render('update', [
                'model' => $model,
            ]);
        }
    }
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];
    }
1318783
public function actionDelete($id)
    {
        $this->findModel($id)->delete();
        if (Yii::$app->request->getIsAjax()) {
            \Yii::$app->response->format = 'json';
            return ['success' => true];
        } else {
            return $this->redirect(['index']);
        }
    }
1054227
public function actionAssign($id)
    {
        $request = \Yii::$app->request;
        if ($request->getIsOptions()) {
            return $this->ResponseOptions($this->verbs()['assign']);
        }
        try{
            $items = Yii::$app->getRequest()->post('items', []);
            $model = new Assignment($id);
            $success = $model->assign($items);
            Yii::$app->getResponse()->format = 'json';
            return array_merge($model->getItems(), ['success' => $success]);
        }catch(Exception $e){
            throw new Exception($e);
        }

    }
1333159
public function getRecipeById($id)
    {
        $result = [
            'className' => (isset($this->classNameById[$id])) ?
                $this->classNameById[$id] :
                null,
            'arguments' => (isset($this->argumentsById[$id])) ?
                $this->argumentsById[$id] :
                null,
            'constructor' => (isset($this->constructorById[$id])) ?
                $this->constructorById[$id] :
                null,
            'dependencies' => (isset($this->dependenciesById[$id])) ?
                $this->dependenciesById[$id] :
                null,
        ];

        return $result;
    }
992834
public function run($id)
	{
		if (!Yii::$app->request->getIsPost()) {
			throw new MethodNotAllowedHttpException();
		}
		$id = (int)$id;
		$result = null;
		
		if (empty($this->modelClass) || !class_exists($this->modelClass)) {
			throw new InvalidConfigException("Model class doesn't exist");
		}
		/* @var $modelClass \yii\db\ActiveRecord */
		$modelClass = $this->modelClass;
		
		
		$attribute = $this->attribute;
		$model = $modelClass::find()->where([$this->primaryKey => $id]);
		
		if (!empty($this->andWhere)) {
			$model->andWhere($this->andWhere);
		}
		
		$model = $model->one();
		
		if (!is_null($this->scenario)) {
			$model->scenario = $this->scenario;
		}
		
		if (!$model->hasAttribute($this->attribute)) {
			throw new InvalidConfigException("Attribute doesn't exist");
		}
		
		if ($model->$attribute == $this->onValue) {
			$model->$attribute = $this->offValue;
		} elseif ($this->onValue instanceof Expression && $model->$attribute != $this->offValue) {
			$model->$attribute = $this->offValue;
		} else {
			$model->$attribute = $this->onValue;
		}
		
		if ($model->save()) {
			if ($this->setFlash) {
				Yii::$app->session->setFlash('success', $this->flashSuccess);
			}
		} else {
			if ($this->setFlash) {
				Yii::$app->session->setFlash('error', $this->flashError);
			}
		}
		if (Yii::$app->request->getIsAjax()) {
			Yii::$app->end();
		}
		/* @var $controller \yii\web\Controller */
		$controller = $this->controller;
		if (!empty($this->redirect)) {
			return $controller->redirect($this->redirect);
		}
		return $controller->redirect(Yii::$app->request->getReferrer());
	}
1188827
public function run( $id ) {

		$modelService = $this->controller->modelService;

		// Find Model
		$model		= $modelService->getById( $id );
		$template	= isset( $model->template ) ? $model->template : Yii::$app->factory->get( 'templateService' )->getGlobalBySlugType( CoreGlobal::TEMPLATE_DEFAULT, $modelService->getParentType() );

		// Update/Render if exist
		if( isset( $model ) && isset( $template ) ) {

			$configClass	= $template->configPath;
			$config			= new $configClass( $model->getDataMeta( 'config' ) );

			$this->controller->setViewPath( $template->configForm );

			if( $config->load( Yii::$app->request->post(), $config->getClassName() ) && $config->validate() ) {

				$modelService->updateDataMeta( $model, 'config', $config );

				return $this->controller->redirect( $this->controller->returnUrl );
			}

			return $this->controller->render( 'config', [
				'model' => $model,
				'config' => $config
			]);
		}

		// Model not found
		//throw new NotFoundHttpException( Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_NOT_FOUND ) );
		throw new NotFoundHttpException( 'Either model or template not found.' );
	}
334170
public function actionStatus($id)
    {
        $model = $this->findModel($id);
        if($model->status == "active") {
            $model->status = "inactive";
        } else {
            $model->status = "active";
        }
        $model->save(false);
        if(Yii::$app->request->getIsAjax()) {
            Yii::$app->response->format = 'json';
            return ['success' => true];
        } else {
            return $this->redirect(['index']);
        }
    }