daily pastebin goal
41%
SHARE
TWEET

Untitled

a guest Jan 20th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use common\models\Podkategoria;
  2. use common\models\PodkategoriaSearch;
  3.  
  4.  
  5. public function actionView($id)
  6.     {
  7.         $searchModel = new PodkategoriaSearch();
  8.  
  9.         $totalCount = Yii::$app->db->createCommand('SELECT COUNT(*) FROM podkategoria WHERE kategoria_id='.$id, [':kategoria_id' => 1])
  10.             ->queryScalar();
  11.  
  12.  
  13.         $dataProvider = new SqlDataProvider([
  14.             'sql' => 'SELECT * FROM podkategoria WHERE kategoria_id='.$id,
  15.             'params' => [':id' => 1],
  16.             'totalCount' => $totalCount,
  17.             'sort' => [
  18.                 'attributes' => [
  19.                     'name' => [
  20.                         'asc' => ['name' => SORT_ASC],
  21.                         'desc' => ['name' => SORT_DESC],
  22.                         'label' => 'Name',
  23.                     ],
  24.                 ],
  25.             ],
  26.             'pagination' => [
  27.                 'pageSize' => 20,
  28.             ],
  29.         ]);
  30.  
  31.         return $this->render('view', [
  32.             'model' => $this->findModel($id),
  33.             'dataProvider' => $dataProvider,
  34.         ]);
  35.     }
RAW Paste Data
Top