/** * Отписка от рассылки комментариев * @param $hash * @param string $url */ public function actionUnsubscribe($hash, $url = '') { $subscriber = Comment::findByHashUrl($hash, $url); $comments = empty($url) ? Comment::find()->where(['email' => $subscriber->email])->all() : Comment::find()->page($url)->where(['email' => $subscriber->email])->all(); foreach ($comments as $comment) { $comment->notify = Comment::NOT_NOTIFY; $comment->save(); } return $this->renderPartial('unsubscribe'); }