Пытался перенаправить запрос в б\д ,если расскоментровать line-a
выдаёт Getting unknown property: app\models\Comment::profile
вот код
Код: Выделить всё
public function saveComment($article_id)
{
$comment = new Comment;
$comment->text = $this->comment;
$comment->user_id = Yii::$app->user->id;
$comment->article_id = $article_id;
$comment->status = 1; //подтверждение коммента 0
$comment->user->photo;
// $comment->profile->avatar(); -line-a
$comment->date = date('Y-m-d'); - line-b
return $comment->save();
}
Код: Выделить всё
<div class="comment-img">
<img width="100" class="img-circle" src="<?//= $comment->profile->avatar; ?>" alt=""> - line-a
<img width="100" class="img-circle" src="<?= $comment->user->photo; ?>" alt=""> -line-b