/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Categoryname::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(['category_id' => $this->category_id]);
     $query->andFilterWhere(['like', 'category', $this->category]);
     return $dataProvider;
 }
Exemple #2
0
/* @var $model backend\models\News */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="news-form">

   <?php 
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
?>

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

    <?php 
echo $form->field($model, 'category')->dropDownList(ArrayHelper::map(Categoryname::find()->all(), 'category_id', 'category'), ['prompt' => 'Kategori Seç']);
?>

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



<?php 
if ($model->logo) {
    echo '<img src="' . \Yii::$app->request->BaseUrl . '/' . $model->logo . '" width="90px">&nbsp;&nbsp;&nbsp;';
    echo Html::a('Delete Logo', ['deleteimg', 'id' => $model->id, 'field' => 'logo'], ['class' => 'btn btn-danger']) . '<p>';