frontend/controllers/ProcurementController.php
/**
     * Creates a new Procurement model.
     * If creation is successful, the browser will be redirected to the 'view' page.
     * @return mixed
     */
Creates a new Procurement model.
If creation is successful, the browser will be redirected to the 'view' page.
@return mixed
Creates a new Procurement model . If creation is successful the browser will be redirected to the ' view ' page . @return mixed
public function actionCreate()
    {
        $procurement = new Procurement();
        if ($procurement->load(Yii::$app->request->post()) ) {
            $abilities = Ability::find()->where(['id' => $procurement->abilities])->all();
            if ($procurement->save()) {
                foreach ($abilities as $ability) {
                    $procurement->link('abilities', $ability);
                }
                return $this->redirect(['view', 'id' => $procurement->id]);
            }
        }
        return $this->render('create', [
            'model' => $procurement,
        ]);
    }
public function actionCreate ( ) { $ procurement = new Procurement ( ) ; if ( $ procurement -> load ( Yii :: $ app -> request -> post ( ) ) ) { $ abilities = Ability :: find ( ) -> where ( [ 'id' => $ procurement -> abilities ] ) -> all ( ) ; if ( $ procurement -> save ( ) ) { foreach ( $ abilities as $ ability ) { $ procurement -> link ( 'abilities' , $ ability ) ; } return $ this -> redirect ( [ 'view' , 'id' => $ procurement -> id ] ) ; } } return $ this -> render ( 'create' , [ 'model' => $ procurement , ] ) ; }
Creates a new Procurement model.
Creates a new Procurement model .