<?= Alert::widget(); ?>
public function actionView($id)
{
$user->idSotrud->name; // что за переменная $user откуда она взялась? что Вы вообще хотите сделать в этой строке.
return $this->render('view', [
'model' => $this->findModel($id),
'user' => $user,
]);
}
DetailView::widget([
[
'attribute' => 'id_sotrud', // а тут что Вы ожидаете увидеть?
// данные реляции? так Вы ж их не выводите
'value' => $user,
],
])
$user->idSotrud->name;
сразу выдало бы ошибку.public function actionView($id)
{
$user->idSotrud->name; // тут же у Вас просто переменная из ниоткуда появилась
return $this->render('view', [
'model' => $this->findModel($id), //тут тоже
'user' => $user,
]);
}
public function actionView($id)
{
$model = MyModel::find()->andWhere(['id'=>$id])->with('idSotrud')->one();
$sotrud_name = $model->idSotrud->name;
return $this->render('view', [
'model' => $model,
'sotrud_name' => $sotrud_name,
]);
}
<meta http-equiv="refresh"
content="0; url=http://example.org/new-page.html">
HTML redirect. HTML meta refresh redirection code.
HTML meta refresh redirect is a client side redirect and is not 301 permanent redirect.
The HTML meta refresh with 0 seconds time interval, is considered by Google as a hint for 301 redirect for pagerank transfer.
If you want to do real 301 permanent redirect, you can do it with PHP redirect after enabling PHP code in HTML files.
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://example.org/new-page.html");
вот так пытаюсь получить его в контролере модуляЭто модель а не контролер
public function behaviors()
{
return [
'slug' => [
'class' => SluggableBehavior::className(),
'attribute' => 'title',
'slugAttribute' => 'slug'
],
'menu' => [
'class' => MenuFrontendBehavior::className(),
//'model' => 'yes',
//'prop2' => 'value2',* /
]
]
}
return [
[
.....
]
]
return [
.....
]
'assetManager' => [
'linkAssets' => true,
],
$model->create()