frontend/controllers/SiteController.php
/**
     * Register new sky user for coding interviews purpose
     */
Register new sky user for coding interviews purpose
Register new sky user for coding interviews purpose
public function actionRegistration()
    {
        $message = '';
        $model = new RegistrationForm();
        if ($model->load(Yii::$app->request->post())) {            
            if ($skyUser = $model->register()) {
                if (!empty($skyUser->id)) {
                    $message = "Sky User " . $skyUser->getFullName() . " was created";
                    $model = new RegistrationForm();
                }
            }
        }
        return $this->render('registration', [
            'model' => $model, 'message' => $message
        ]);
    }
public function actionRegistration ( ) { $ message = '' ; $ model = new RegistrationForm ( ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) ) { if ( $ skyUser = $ model -> register ( ) ) { if ( ! empty ( $ skyUser -> id ) ) { $ message = " Sky User  " . $ skyUser -> getFullName ( ) . "  was created " ; $ model = new RegistrationForm ( ) ; } } } return $ this -> render ( 'registration' , [ 'model' => $ model , 'message' => $ message ] ) ; }
Register new sky user for coding interviews purpose
Register new sky user for coding interviews purpose
// If SkyUser was successfully saved to DB, id will not be empty // Return success message to UI