PageController.php 990 Bytes
<?php
    namespace frontend\controllers;
    
    use artbox\core\models\Page;
    use yii\helpers\Json;
    use yii\helpers\Url;
    use yii\web\Controller;
    use yii\web\NotFoundHttpException;
    
    /**
     * Class PageController
     *
     * @package frontend\controllers
     */
    class PageController extends Controller
    {
        public function actionView($id)
        {
            $model = $this->findModel($id);
            
            var_dump(Url::to(Json::decode($model->lang->alias->route)));
            
            return $this->render(
                'view',
                [
                    'model' => $model,
                ]
            );
        }
        
        protected function findModel($id)
        {
            $model = Page::findOne($id);
            
            if (!empty($model)) {
                return $model;
            } else {
                throw new NotFoundHttpException('Model not found');
            }
        }
    }