public function actionDownload($id) { $model = \app\models\Download::findOne(['id' => $id]); if ($model == null) { } else { //throw new \yii\web\HttpException(404, 'The requested page does not exist.'); $comp = \app\models\Company::findOne($model->company_id); $comp->select($model->company_id); $id = (int) $model->file_id; $model = \app\models\Files::findOne($id); if ($model === null) { throw new \yii\web\HttpException(404, 'The requested page does not exist.'); } $file = $model->getFullPath() . $model->id; return Yii::$app->getResponse()->sendFile($file, $model->name); } }
public static function getLogo() { if (!\app\helpers\Linet3Helper::isConsole()) { return \Yii::$app->urlManager->createAbsoluteUrl("/site/download/" . Linet3Helper::getSetting('company.logo')); //$base . ; } else { //console $download = \app\models\Download::findOne(["id" => Linet3Helper::getSetting('company.logo')]); $id = (int) $download->file_id; $logo = \app\models\Files::findOne($id); return $logo->getFullFilePath(); } }