frontend/controllers/PostController.php
/**
     * Finds the Post model based on its primary key value.
     * If the model is not found, a 404 HTTP exception will be thrown.
     *
     * @param string $slug Post type slug
     * @throws \yii\web\NotFoundHttpException
     * @return PostType the loaded model
     */
Finds the Post model based on its primary key value.
If the model is not found, a 404 HTTP exception will be thrown.

@param string $slug Post type slug
@throws \yii\web\NotFoundHttpException
@return PostType the loaded model
Finds the Post model based on its primary key value . If the model is not found a 404 HTTP exception will be thrown . @param string $slug Post type slug @throws \ yii \ web \ NotFoundHttpException @return PostType the loaded model
protected function findPostTypeBySlug($slug)
    {
        $model = PostType::findOne(['slug' => $slug]);
        if ($model) {
            return $model;
        }
        throw new NotFoundHttpException(Yii::t('writesdown', 'The requested page does not exist.'));
    }
protected function findPostTypeBySlug ( $ slug ) { $ model = PostType :: findOne ( [ 'slug' => $ slug ] ) ; if ( $ model ) { return $ model ; } throw new NotFoundHttpException ( Yii :: t ( 'writesdown' , 'The requested page does not exist.' ) ) ; }
Finds the Post model based on its primary key value.
Finds the Post model based on its primary key value .