Commit 649de7417b3d525e34fdf7a671c50d4330b5ae6c
1 parent
7e6d3f52
24.02.16
Showing
3 changed files
with
15 additions
and
4 deletions
Show diff stats
frontend/controllers/SiteController.php
| ... | ... | @@ -2,9 +2,11 @@ |
| 2 | 2 | namespace frontend\controllers; |
| 3 | 3 | |
| 4 | 4 | use common\models\Cities; |
| 5 | +use common\models\CompanyInfo; | |
| 5 | 6 | use common\models\Country; |
| 6 | 7 | use common\models\Specialization; |
| 7 | 8 | use common\models\UserInfo; |
| 9 | +use Faker\Provider\is_IS\Company; | |
| 8 | 10 | use Yii; |
| 9 | 11 | use common\models\LoginForm; |
| 10 | 12 | use frontend\models\PasswordResetRequestForm; |
| ... | ... | @@ -258,6 +260,15 @@ class SiteController extends Controller |
| 258 | 260 | |
| 259 | 261 | $user_info->save(); |
| 260 | 262 | |
| 263 | + if($user->type == 2 ){ | |
| 264 | + | |
| 265 | + $company_info = new CompanyInfo(); | |
| 266 | + $company_info->load(Yii::$app->request->post(),'SignupForm'); | |
| 267 | + $company_info->name = $user->id; | |
| 268 | + | |
| 269 | + $user_info->save(); | |
| 270 | + } | |
| 271 | + | |
| 261 | 272 | if (Yii::$app->getUser()->login($user)) { |
| 262 | 273 | return $this->goHome(); |
| 263 | 274 | } | ... | ... |
frontend/models/SignupForm.php
| ... | ... | @@ -21,7 +21,7 @@ class SignupForm extends Model |
| 21 | 21 | public $is_customer; |
| 22 | 22 | public $is_freelancer; |
| 23 | 23 | public $city; |
| 24 | - public $company_name; | |
| 24 | + public $name; | |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * @inheritdoc |
| ... | ... | @@ -42,7 +42,7 @@ class SignupForm extends Model |
| 42 | 42 | ['email', 'string', 'max' => 255], |
| 43 | 43 | ['email', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This email address has already been taken.'], |
| 44 | 44 | |
| 45 | - ['company_name', 'required'], | |
| 45 | + ['name', 'required'], | |
| 46 | 46 | ['firstname', 'required'], |
| 47 | 47 | |
| 48 | 48 | |
| ... | ... | @@ -97,7 +97,7 @@ class SignupForm extends Model |
| 97 | 97 | 'alt_location' => 'Город не в списке', |
| 98 | 98 | 'is_customer' => '', |
| 99 | 99 | 'is_freelancer' => '', |
| 100 | - 'company_name' => 'Название компании' | |
| 100 | + 'name' => 'Название компании' | |
| 101 | 101 | ]; |
| 102 | 102 | } |
| 103 | 103 | ... | ... |
frontend/views/site/registration.php
| ... | ... | @@ -89,7 +89,7 @@ |
| 89 | 89 | |
| 90 | 90 | <div class="input-blocks-wrapper"> |
| 91 | 91 | <div class="input-blocks"> |
| 92 | - <?= $form->field($model, 'company_name')->textInput(['class'=>'custom-input-2'])?> | |
| 92 | + <?= $form->field($model, 'name')->textInput(['class'=>'custom-input-2'])?> | |
| 93 | 93 | </div> |
| 94 | 94 | </div> |
| 95 | 95 | ... | ... |