<?= ListView::widget([
'dataProvider' => $dataProvider,
'itemOptions' => ['class' => 'item'],
'itemView' => '_list_item',
'viewParams' => [
'achieves' => AchieveUser::find()
->where([
'id_user' => Yii::$app->user->identity->id,
])
->select('id_achieve')
->index('id_achieve')
->all()
],
]) ?>
<?php
if(isset($achieves[$model->id])){
echo 'Добавлено';
}
echo $model->title;
?><code >
$file=UploadedFile::getInstance($model, 'imageFile');
if($file &&$file instanceof UploadedFile){
$model->imageFile = $file;
if ($model->upload()) {
// file is uploaded successfully
return;
}
}