/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Userroles::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
Esempio n. 2
0
?>

    <?php 
echo $form->field($model, 'username')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'first_name')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'last_name')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'user_role_id')->dropDownList(ArrayHelper::map(Userroles::find()->all(), 'id', 'name'), ['prompt' => 'Select Role']);
?>

    <?php 
echo $form->field($model, 'email')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'password')->passwordInput(['maxlength' => true]);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>