controllers/AdminController.php
public function actionIndex()
    {
        $model = new Location();
        if ($model->load(\Yii::$app->request->post()) && $model->save()) {
            $model = new Location(); //reset model
        }

        $searchModel = new LocationSearch(['pagination' => TRUE]);
        $dataProvider = $searchModel->search(\Yii::$app->request->queryParams);

        return $this->render('index', [
                    'searchModel' => $searchModel,
                    'dataProvider' => $dataProvider,
                    'model' => $model,
        ]);
    }
public function actionIndex()
    {
        $model = new Location();
        if ($model->load(\Yii::$app->request->post()) && $model->save()) {
            $model = new Location(); //reset model
        }

        $searchModel = new LocationSearch(['pagination' => TRUE]);
        $dataProvider = $searchModel->search(\Yii::$app->request->queryParams);

        return $this->render('index', [
                    'searchModel' => $searchModel,
                    'dataProvider' => $dataProvider,
                    'model' => $model,
        ]);
    }
public function actionIndex ( ) { $ model = new Location ( ) ; if ( $ model -> load ( \ Yii :: $ app -> request -> post ( ) ) && $ model -> save ( ) ) { $ model = new Location ( ) ; //reset model } $ searchModel = new LocationSearch ( [ 'pagination' => TRUE ] ) ; $ dataProvider = $ searchModel -> search ( \ Yii :: $ app -> request -> queryParams ) ; return $ this -> render ( 'index' , [ 'searchModel' => $ searchModel , 'dataProvider' => $ dataProvider , 'model' => $ model , ] ) ; }
Lists all Location models.
@return mixed
Lists all Location models .