BlogController.php
988 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
namespace frontend\controllers;
use artbox\weblog\models\Article;
use yii\data\ActiveDataProvider;
use yii\web\Controller;
/**
* Class BlogController
*
* @package frontend\controllers
*/
class BlogController extends Controller
{
public function actionIndex()
{
$query = Article::find()
->with('lang.alias')
->with('image')
->where([ 'status' => true ]);
$dataProvider = new ActiveDataProvider(
[
'query' => $query,
'pagination' => [
'pageSize' => 3,
],
]
);
return $this->render(
'index',
[
'dataProvider' => $dataProvider,
]
);
}
}