public function actionIndex()
    {
        $rates = Currency::find()->orderBy('id DESC')->all();
        $model = new Currency();

        if (Yii::$app->request->isPost) {
            if ($model->load(Yii::$app->request->post())) {

                if ($model->validate()) {
                    $model->save();
                    $this->trigger(self::EVENT_AFTER_CHANGE);
                }
                return $this->redirect(\Yii::$app->request->referrer);
            }
            else {
                throw new Exception();
            }
        }
        return $this->render('index', [
            'rates' => $rates,
            'model' => $model
        ]);
    }
public function actionIndex()
    {
        $rates = Currency::find()->orderBy('id DESC')->all();
        $model = new Currency();

        if (Yii::$app->request->isPost) {
            if ($model->load(Yii::$app->request->post())) {

                if ($model->validate()) {
                    $model->save();
                    $this->trigger(self::EVENT_AFTER_CHANGE);
                }
                return $this->redirect(\Yii::$app->request->referrer);
            }
            else {
                throw new Exception();
            }
        }
        return $this->render('index', [
            'rates' => $rates,
            'model' => $model
        ]);
    }
public function actionIndex ( ) { $ rates = Currency :: find ( ) -> orderBy ( 'id DESC' ) -> all ( ) ; $ model = new Currency ( ) ; if ( Yii :: $ app -> request -> isPost ) { if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) ) { if ( $ model -> validate ( ) ) { $ model -> save ( ) ; $ this -> trigger ( self :: EVENT_AFTER_CHANGE ) ; } return $ this -> redirect ( \ Yii :: $ app -> request -> referrer ) ; } else { throw new Exception ( ) ; } } return $ this -> render ( 'index' , [ 'rates' => $ rates , 'model' => $ model ] ) ; }
Lists all Currency models.
@return mixed
@throws Exception
Lists all Currency models .