backend/controllers/PostController.php
/**
     * Lists all Post models on specific post type.
     * If there is user, the action will generate list of all Post models based on user.
     *
     * @param integer $type
     * @param null|string $user
     * @throws \yii\web\ForbiddenHttpException
     * @throws \yii\web\NotFoundHttpException
     * @return mixed
     */
Lists all Post models on specific post type.
If there is user, the action will generate list of all Post models based on user.


Lists all Post models on specific post type . If there is user the action will generate list of all Post models based on user .
public function actionIndex($type, $user = null)
    {
        $postType = $this->findPostType($type);
        $searchModel = new PostSearch();
        $dataProvider = $searchModel->search(Yii::$app->request->queryParams, $type, $user);
        if (!Yii::$app->user->can($postType->permission)) {
            throw new ForbiddenHttpException(Yii::t('writesdown', 'You are not allowed to perform this action.'));
        }
        return $this->render('index', [
            'searchModel' => $searchModel,
            'dataProvider' => $dataProvider,
            'postType' => $postType,
            'user' => $user,
        ]);
    }
public function actionIndex ( $ type , $ user = null ) { $ postType = $ this -> findPostType ( $ type ) ; $ searchModel = new PostSearch ( ) ; $ dataProvider = $ searchModel -> search ( Yii :: $ app -> request -> queryParams , $ type , $ user ) ; if ( ! Yii :: $ app -> user -> can ( $ postType -> permission ) ) { throw new ForbiddenHttpException ( Yii :: t ( 'writesdown' , 'You are not allowed to perform this action.' ) ) ; } return $ this -> render ( 'index' , [ 'searchModel' => $ searchModel , 'dataProvider' => $ dataProvider , 'postType' => $ postType , 'user' => $ user , ] ) ; }
Lists all Post models on specific post type.
Lists all Post models on specific post type .