e75f2ac9
Alexey Boroda
-Doctor pages fro...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
<?php
namespace frontend\controllers;
use common\models\Persone;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
/**
* Class PersoneController
*
* @package frontend\controllers
*/
class PersoneController extends Controller
{
/**
* @return string
*/
public function actionIndex()
{
$persones = Persone::find()
->with('lang.alias')
->all();
|
6179ff51
Timur Kastemirov
language markup f...
|
25
26
27
28
29
30
31
32
33
|
$aliasIdsForBlog = [98, 99, 100];
$this->view->params['aliases'] = \artbox\core\models\Alias::find()
->where(
[
'id' => $aliasIdsForBlog
]
)
->all();
|
e75f2ac9
Alexey Boroda
-Doctor pages fro...
|
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
return $this->render(
'index',
[
'persones' => $persones,
]
);
}
/**
* @param int $id
*
* @return string
*/
public function actionView(int $id)
{
$model = $this->findModel($id);
|
6179ff51
Timur Kastemirov
language markup f...
|
51
52
|
$this->view->params['model'] = $model;
|
e75f2ac9
Alexey Boroda
-Doctor pages fro...
|
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
return $this->render(
'view',
[
'model' => $model,
]
);
}
/**
* @param $id
*
* @return array|null|\yii\db\ActiveRecord
* @throws \yii\web\NotFoundHttpException
*/
protected function findModel($id)
{
$model = Persone::find()
->with('lang.alias')
->where([ 'id' => $id ])
->one();
if (empty($model)) {
throw new NotFoundHttpException();
} else {
return $model;
}
}
}
|