public function actionSubscribe($queue_name)
    {
        /** @var QueueInterface $queue */
        list($queue, $authItems) = $this->loadQueue($queue_name, ['nfy.queue.subscribe']);

        $form = new models\SubscriptionForm();
        if (isset($_POST['SubscriptionForm'])) {
            $form->attributes = $_POST['SubscriptionForm'];
            if ($form->validate()) {
                $queue->subscribe(Yii::$app->user->getId(), $form->label, $form->categories, $form->exceptions);

                return $this->redirect(['index']);
            }
        }

        return $this->render('subscription', [
            'queue' => $queue,
            'model' => $form,
        ]);
    }
public function actionSubscribe($queue_name)
    {
        /** @var QueueInterface $queue */
        list($queue, $authItems) = $this->loadQueue($queue_name, ['nfy.queue.subscribe']);

        $form = new models\SubscriptionForm();
        if (isset($_POST['SubscriptionForm'])) {
            $form->attributes = $_POST['SubscriptionForm'];
            if ($form->validate()) {
                $queue->subscribe(Yii::$app->user->getId(), $form->label, $form->categories, $form->exceptions);

                return $this->redirect(['index']);
            }
        }

        return $this->render('subscription', [
            'queue' => $queue,
            'model' => $form,
        ]);
    }
public function actionSubscribe ( $ queue_name ) { /** @var QueueInterface $queue */ list ( $ queue , $ authItems ) = $ this -> loadQueue ( $ queue_name , [ 'nfy.queue.subscribe' ] ) ; $ form = new models \ SubscriptionForm ( ) ; if ( isset ( $ _POST [ 'SubscriptionForm' ] ) ) { $ form -> attributes = $ _POST [ 'SubscriptionForm' ] ; if ( $ form -> validate ( ) ) { $ queue -> subscribe ( Yii :: $ app -> user -> getId ( ) , $ form -> label , $ form -> categories , $ form -> exceptions ) ; return $ this -> redirect ( [ 'index' ] ) ; } } return $ this -> render ( 'subscription' , [ 'queue' => $ queue , 'model' => $ form , ] ) ; }
Subscribe current user to selected queue.
@param string $queue_name
@return string|\yii\web\Response
Subscribe current user to selected queue .