/* @var $content string */ if (Yii::$app->controller->action->id === 'login') { /** * Do not use this code in your template. Remove it. * Instead, use the code $this->layout = '//main-login'; in your controller. */ echo $this->render('main-login', ['content' => $content]); } else { if (class_exists('backend\\assets\\AppAsset')) { backend\assets\AppAsset::register($this); } else { app\assets\AppAsset::register($this); } dmstr\web\AdminLteAsset::register($this); $directoryAsset = Yii::$app->assetManager->getPublishedUrl('@vendor/almasaeed2010/adminlte/dist'); $userModel = \mirage\user\models\Profile::findOne(Yii::$app->user->id); ?> <?php $this->beginPage(); ?> <!DOCTYPE html> <html lang="<?php echo Yii::$app->language; ?> "> <head> <meta charset="<?php echo Yii::$app->charset; ?> "/> <meta name="viewport" content="width=device-width, initial-scale=1">
/** * Finds the Profile model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Profile the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Profile::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function afterDelete() { $profile = Profile::findOne(['user_id' => $this->id]); $profile->delete(); $removeDir = rtrim(Yii::$app->controller->module->userUploadDir, '/') . '/' . $this->id; FileHelper::removeDirectory($removeDir); parent::afterDelete(); }