/**
  * Lists all ProviderIndustries models.
  * @return mixed
  */
 public function actionIndex($username = null)
 {
     if (isset($username)) {
         $user = User::find()->where(['username' => $username])->one();
     }
     if ($user) {
         $this->layout = '//user_list';
         $searchModel = new ProviderIndustriesSearch();
         $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
         return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'user' => $user]);
     } else {
         $this->redirect(Yii::$app->request->baseUrl . '/providers');
     }
 }
 /**
  * Lists all ProviderServices models.
  * @return mixed
  */
 public function actionIndex($username = null)
 {
     $this->layout = '/provider_services';
     if (isset($username)) {
         $user = User::find()->where(['username' => $username])->one();
     }
     if ($user and $user->provider && $user->id == Yii::$app->user->id) {
         $searchModel = new ProviderIndustriesSearch();
         $searchModel->provider_id = $user->provider->id;
         $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
         if (Yii::$app->request->post('ProviderIndustries', []) && $this->saveIndustry($user->provider)) {
             return $this->redirect('services');
         }
         if (Yii::$app->request->post('ProviderIndustrySkills', []) && $this->saveSkills()) {
             return $this->redirect('services');
         }
         if (Yii::$app->request->post('ProviderServices', []) && $this->saveServices()) {
             return $this->redirect('services');
         }
         return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'user' => $user]);
     } else {
         $this->redirect(Yii::$app->request->baseUrl . '/providers');
     }
 }