public function actionLast($id = null)
    {
        if (!is_numeric($id) || $id < 1) {
            $this->error(Yii::t('podium/flash', 'Sorry! We can not find the thread you are looking for.'));
            return $this->redirect(['forum/index']);
        }

        $thread = Thread::find()->where(['id' => $id])->limit(1)->one();
        if (empty($thread)) {
            $this->error(Yii::t('podium/flash', 'Sorry! We can not find the thread you are looking for.'));
            return $this->redirect(['forum/index']);
        }

        $url = [
            'forum/thread',
            'cid' => $thread->category_id,
            'fid' => $thread->forum_id,
            'id' => $thread->id,
            'slug' => $thread->slug
        ];

        $count = $thread->postsCount;
        $page = floor($count / 10) + 1;
        if ($page > 1) {
            $url['page'] = $page;
        }
        return $this->redirect($url);
    }
public function actionLast($id = null)
    {
        if (!is_numeric($id) || $id < 1) {
            $this->error(Yii::t('podium/flash', 'Sorry! We can not find the thread you are looking for.'));
            return $this->redirect(['forum/index']);
        }

        $thread = Thread::find()->where(['id' => $id])->limit(1)->one();
        if (empty($thread)) {
            $this->error(Yii::t('podium/flash', 'Sorry! We can not find the thread you are looking for.'));
            return $this->redirect(['forum/index']);
        }

        $url = [
            'forum/thread',
            'cid' => $thread->category_id,
            'fid' => $thread->forum_id,
            'id' => $thread->id,
            'slug' => $thread->slug
        ];

        $count = $thread->postsCount;
        $page = floor($count / 10) + 1;
        if ($page > 1) {
            $url['page'] = $page;
        }
        return $this->redirect($url);
    }
public function actionLast ( $ id = null ) { if ( ! is_numeric ( $ id ) || $ id < 1 ) { $ this -> error ( Yii :: t ( 'podium/flash' , 'Sorry! We can not find the thread you are looking for.' ) ) ; return $ this -> redirect ( [ 'forum/index' ] ) ; } $ thread = Thread :: find ( ) -> where ( [ 'id' => $ id ] ) -> limit ( 1 ) -> one ( ) ; if ( empty ( $ thread ) ) { $ this -> error ( Yii :: t ( 'podium/flash' , 'Sorry! We can not find the thread you are looking for.' ) ) ; return $ this -> redirect ( [ 'forum/index' ] ) ; } $ url = [ 'forum/thread' , 'cid' => $ thread -> category_id , 'fid' => $ thread -> forum_id , 'id' => $ thread -> id , 'slug' => $ thread -> slug ] ; $ count = $ thread -> postsCount ; $ page = floor ( $ count / 10 ) + 1 ; if ( $ page > 1 ) { $ url [ 'page' ] = $ page ; } return $ this -> redirect ( $ url ) ; }
Direct link for the last post in thread of given ID.
@param int $id
@return Response
Direct link for the last post in thread of given ID .