public function currentProvider($model)
 {
     if ($user = \common\models\User::findOne(Yii::$app->user->id)) {
         $user->is_provider = 1;
         $user->member = 0;
         $user->role = 'provider';
         if ($user->save()) {
             // create temp provider
             $provider = new \common\models\Provider();
             $provider->user_id = $user->id;
             $provider->industry_id = $model->industry_id;
             $provider->loc_id = 1;
             $provider->legal_form = 'freelancer';
             $provider->type = 'service_provider';
             $provider->department_type = 'hq';
             $provider->status = 'inactive';
             $provider->is_active = 0;
             $provider->registration_time = date('Y-m-d H:i:s');
             //$provider->save();
             if ($provider->save()) {
                 // provider Industry
                 if ($providerIndustry = \common\models\ProviderIndustries::findOne($provider->initialIndustry->id)) {
                     $proserv = new \common\models\ProviderServices();
                     $proserv->provider_industry_id = $providerIndustry->id;
                     $proserv->provider_id = $provider->id;
                     $proserv->industry_id = $model->industry_id;
                     $proserv->service_id = $model->id;
                     $proserv->is_set = 1;
                     $proserv->update_time = date('Y-m-d H:i:s');
                     $proserv->save();
                 }
             }
         }
         return $user;
     }
     return false;
 }
 /**
  * Finds the ProviderIndustries model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return ProviderIndustries the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = ProviderIndustries::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }