protected function findModel($id) { if (($model = Departments::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Departments::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['department_id' => $this->department_id, 'branches_branch_id' => $this->branches_branch_id, 'companies_company_id' => $this->companies_company_id, 'department_created_date' => $this->department_created_date]); $query->andFilterWhere(['like', 'department_name', $this->department_name])->andFilterWhere(['like', 'department_status', $this->department_status]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Departments::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(['department_id' => $this->department_id, 'branches_branch_id' => $this->branches_branch_id, 'companies_company_id' => $this->companies_company_id, 'department_created_date' => $this->department_created_date]); $query->andFilterWhere(['like', 'department_name', $this->department_name])->andFilterWhere(['like', 'department_status', $this->department_status]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Departments::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([ // 'recid' => $this->recid, // 'sectionid' => $this->sectionid, // 'createdate' => $this->createdate, // 'updatedate' => $this->updatedate, // ]); $query->orFilterWhere(['like', 'departmentname', $this->globalSearch])->orFilterWhere(['like', 'description', $this->globalSearch]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getDepartments() { return $this->hasMany(Departments::className(), ['branches_branch_id' => 'branch_id']); }
/** * @return \yii\db\ActiveQuery */ public function getDepartments() { return $this->hasMany(Departments::className(), ['company_id' => 'id']); }
public function getDepartment() { return $this->hasOne(\backend\models\Departments::className(), ['recid' => 'departmentid']); }
<?php echo $form->field($model, 'amgen_attendees')->widget(\yii\jui\AutoComplete::classname(), ['clientOptions' => ['source' => $data]]); ?> <?php echo $form->field($model, 'title')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'department_id')->dropDownList(ArrayHelper::map(Departments::find()->asArray()->all(), 'ID', 'Name'), ['ID' => 'Name']); ?> <?php echo $form->field($model, 'meeting_group_id')->dropDownList(ArrayHelper::map(MeetingGroups::find()->asArray()->all(), 'id', 'Group_name'), ['id' => 'Group_name']); ?> <?php echo $form->field($model, 'status_id')->dropDownList(ArrayHelper::map(Status::find()->asArray()->all(), 'id', 'status'), ['id' => 'status']); ?> <div class="form-group">
/** * @return \yii\db\ActiveQuery */ public function getDepartment() { return $this->hasOne(Departments::className(), ['department_id' => 'department_id']); }