/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = TicketStatus::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(['ticket_status_id' => $this->ticket_status_id, 'tstatus' => $this->tstatus]);
     return $dataProvider;
 }
 /**
  * Finds the TicketStatus model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return TicketStatus the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = TicketStatus::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getTicketStatus()
 {
     return $this->hasOne(TicketStatus::className(), ['ticket_status_id' => 'ticket_status_id']);
 }
    <?php 
$form = ActiveForm::begin();
?>

   

    <?php 
$ticket = Ticket::find()->all();
$listData = ArrayHelper::map($ticket, 'ticket_id', 'ticketnumber');
echo $form->field($model, 'ticket_id')->dropDownList($listData, ['prompt' => 'Select Ticket Number']);
?>

    

    <?php 
$ticket_status = TicketStatus::find()->all();
$listData = ArrayHelper::map($ticket_status, 'ticket_status_id', 'status_name');
echo $form->field($model, 'ticket_status_id')->dropDownList($listData, ['prompt' => 'Select Ticket Status']);
?>

    
   <?php 
$employee = Employee::find()->all();
$listData = ArrayHelper::map($employee, 'employee_id', 'firstname', 'lastname');
echo $form->field($model, 'employee_id')->dropDownList($listData, ['prompt' => 'Select Case Number']);
?>

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