public function canBeAnswered() {
        $countInThread = Comment::find()
            ->where(['thread' => $this->thread, 'user_id' => Yii::$app->user->id])
            ->count();
        return !Yii::$app->user->isGuest &&
            $this->last && // this is a last comment in a thread
            Yii::$app->user->identity->group == User::GROUP_COMMENTATOR && // you are a commentator
            $this->user_id != Yii::$app->user->id && // last comment not yours
            $countInThread > 0; // you begin this thread
            
    }
public function canBeAnswered() {
        $countInThread = Comment::find()
            ->where(['thread' => $this->thread, 'user_id' => Yii::$app->user->id])
            ->count();
        return !Yii::$app->user->isGuest &&
            $this->last && // this is a last comment in a thread
            Yii::$app->user->identity->group == User::GROUP_COMMENTATOR && // you are a commentator
            $this->user_id != Yii::$app->user->id && // last comment not yours
            $countInThread > 0; // you begin this thread
            
    }
public function canBeAnswered ( ) { $ countInThread = Comment :: find ( ) -> where ( [ 'thread' => $ this -> thread , 'user_id' => Yii :: $ app -> user -> id ] ) -> count ( ) ; return ! Yii :: $ app -> user -> isGuest && $ this -> last && // this is a last comment in a thread Yii :: $ app -> user -> identity -> group == User :: GROUP_COMMENTATOR && // you are a commentator $ this -> user_id != Yii :: $ app -> user -> id && // last comment not yours $ countInThread > 0 ; // you begin this thread }
Comment can be answered if User is not a guest and
this is the last comment in a thread and
User is a commentator and
last comment not belongs to User
User begun the thread.
@return boolean
Comment can be answered if User is not a guest and this is the last comment in a thread and User is a commentator and last comment not belongs to User User begun the thread .