PackageController.php 988 Bytes
<?php
    /**
     * Created by PhpStorm.
     * User: stes
     * Date: 01.06.18
     * Time: 12:20
     */
    
    namespace frontend\controllers;
    
    use common\models\Package;
    use yii\web\Controller;

    class PackageController extends Controller
    {
        public function actionView($id){
            $package = Package::find()->with('language')->where(['id' => $id])->one();
            $package->body = str_replace('[[button]]', '<span class="btn_ modal-link" data-form="callback">'.\Yii::t('app','Make an appointment').'</span>', $package->body);
    
            return $this->render('view', [
               'package' => $package
            ]);
        }
        
        public function actionIndex(){
            
            $packages =  Package::find()->with(['language.alias'])->where(['status' => true])->orderBy('sort')->all();
            
            return $this->render('index', [
               'packages' => $packages
            ]);
        }
    }